Questions tagged [dax]

Expression language used in Microsoft Power Pivot, Analysis Services, and Power BI for performing analytical calculations.

DAX stands for Data Analysis eXpressions, an expression language created by Microsoft for performing custom analytical calculations within the Power Pivot add-in for Excel, Analysis Services, and Power BI.

DAX functions work on a column or table level to make use of the underlying compression technology used in PowerPivot.

Expressions created in DAX can be used in several ways:

  1. In calculated columns, evaluating the function on a row-by-row basis over an entire table.
  2. In measures, which may be manipulated and aggregated differently, depending on context.
  3. To return a tabular resultset when a table expression is evaluated (fills role of a general purpose query language)
  4. To create a calculated table in a Power BI model as part of the modelling process

Useful Links

8483 questions
55
votes
4 answers

What's the difference between DAX and Power Query (or M)?

I have been working on Power BI for a while now and I often get confused when I browse through help topics of it. They often refer to the functions and formulas being used as DAX functions or Power Query, but I am unable to tell the difference…
user2724541
20
votes
3 answers

How to get month name from month number in Power BI?

I have Year number and Month Number in my data. How using DAX can I get the month name out of month number? In SSRS its very easy. But how to achieve that using DAX?
Serdia
  • 4,242
  • 22
  • 86
  • 159
17
votes
2 answers

Recursion in DAX

I don't know if this is even possible, but I'd like to be able to create a calculated column where each row is dependent on the rows above it. A classic example of this is the Fibonacci sequence, where the sequence is defined by the recurrence…
Alexis Olson
  • 38,724
  • 7
  • 42
  • 64
16
votes
4 answers

DAX Calculate function with and without FILTER

What is the difference in results of CALCULATE function if we use it with and without FILTER function. Suppose we have those two measures: Measure1 = CALCULATE([X], 'FactTable'[Color]="Red") Measure2 = CALCULATE([X], FILTER('FactTable',…
Przemyslaw Remin
  • 6,276
  • 25
  • 113
  • 191
15
votes
0 answers

Force DAX SWITCH function to use strict (lazy) short-circuit evaluation

Set up: Similar to this question on a MSDN forum, I have a measure that switches between various other measures (some of them much more complex than others). The measure looks like this (my actual measure has more cases): VariableMeasure = VAR…
Alexis Olson
  • 38,724
  • 7
  • 42
  • 64
15
votes
2 answers

How to format new measure (not column) in power BI as percentage?

When I create a new measure with formula, i.e. sum(col1)/max(col2), it automatically converts the result into #.#% format. Strangely, it doesn't happen all the time; sometimes it just gives result #.## format. Any idea of how to format a new…
Dave D.
  • 737
  • 3
  • 10
  • 23
15
votes
6 answers

Converting an Integer to a Text Value in Power BI

I’m creating a calculated column in a Power BI report. The calculated column concatenates integer and text columns. I tried using the below query to accomplish this, but it resulted in a syntax error. CalculatedColumn =…
bmsqldev
  • 2,627
  • 10
  • 31
  • 65
14
votes
3 answers

DAX formula to concatenate three columns

I am mew to DAX. How can I concatenate three different columns say First_Name, Middle_Name and Last_Name to a single column with a space in between using CONCATENATE function in DAX. At present I could concatenate only two…
user2107971
  • 215
  • 1
  • 4
  • 9
13
votes
3 answers

Dynamic DAX Number Format

I want to dynamically change the number format of a DAX measure, based on a dimension value (or indeed, based on the order of magnitude of the measure value). I understand I can use SWITCH and FORMAT, as demonstrated by Kaspar De Jonge here:…
Olly
  • 7,749
  • 1
  • 19
  • 38
11
votes
1 answer

Power BI, DAX--How do I count rows in one table based on values in another table?

I have two tables, lets call them Table1 and Table2. Table1 has a column of unique values, Table2 has a column with the same values but repeated. What I am trying to accomplish is to calculate the number of times that value appears in Table2 as a…
Bad_Mama_Jama
  • 186
  • 2
  • 2
  • 11
10
votes
1 answer

Combine PowerBI DAX Filter and SELECTCOLUMN

I want to create a new table based on this one: that filters for Warehouse=2 and "drops" the columns "Price" and "Cost" like this: I have managed to apply the filter in the first step using: FILTER(oldtable;oldtable[Warehouse]=2) and then in the…
Lorenz Joe
  • 103
  • 1
  • 1
  • 5
10
votes
3 answers

Multiple Linear Regression in Power BI

Suppose I have a set of returns and I want to compute its beta values versus different market indices. Let's use the following set of data in a table named Returns for the sake of having a concrete example: Date Equity Duration Credit …
Alexis Olson
  • 38,724
  • 7
  • 42
  • 64
10
votes
3 answers

DAX - Last Value

I have this table I would like to create measurement get the last traded value for each day. E.g. How the DAX query should look like?
user4815740
  • 311
  • 2
  • 8
  • 17
10
votes
1 answer

Power BI (DAX): Distinct Count Filtered by Condition

I have a data set with publishers with revenue by month. Publishers are considered to be "active" month if their revenue is equal or greater than 1000 for a given month. Now, I want to count the distinct number of "active" publishers over a…
AME
  • 5,234
  • 23
  • 71
  • 81
10
votes
7 answers

No QUARTER() in DAX? Really?

While building a Calendar table with PowerQuery for a PowerPivot model in Excel 2013 I use its Date.QuarterOfYear function to get the number of the quarter. Building the same thing in SSAS Tabular requires some workarounds. There's no equivalent…
erop
  • 1,510
  • 1
  • 14
  • 27
1
2 3
99 100