Questions tagged [dax]

Expression language used in Microsoft Power Pivot, SQL Server Analysis Services Tabular, 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, SQL Server Analysis Services Tabular, 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

5317 questions
46
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
14
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
  • 33,168
  • 5
  • 31
  • 54
14
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
  • 4,632
  • 11
  • 78
  • 138
12
votes
2 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
  • 6,553
  • 1
  • 15
  • 33
11
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
  • 165
  • 1
  • 3
  • 9
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
  • 33,168
  • 5
  • 31
  • 54
10
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.
  • 487
  • 3
  • 7
  • 20
9
votes
2 answers

Get Local Time on Power BI Service

As you all might already know, TODAY() function returns UTC time when published to Power BI Service. Our requirement is to return the local (EST) date. As a solution, we created a custom measure that adds UTC offset hours for EST in NOW() and…
Pratik Bhavsar
  • 705
  • 5
  • 26
9
votes
6 answers

Power BI Desktop DAX restart running total column

I have a table where every person has a record for every day of the year. I used this function to achieve a running total based on the daily balance column CALCULATE( SUM(Leave[Daily Balance]), FILTER( ALLEXCEPT(Leave, Leave[Employee Id]), …
LynseyC
  • 93
  • 5
9
votes
2 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
  • 301
  • 1
  • 4
  • 16
8
votes
2 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
  • 3,649
  • 11
  • 53
  • 111
8
votes
6 answers

how to convert a Integer to Text value in Power BI

I am creating a calculated column in existing power BI report. the calculated column concatenates integer & text columns. I tried below query which give syntax error to me, = Number.ToText(table1.[RegionID]) & " " & table1.[RegionName] I tried…
bmsqldev
  • 2,329
  • 5
  • 22
  • 56
8
votes
5 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,434
  • 1
  • 14
  • 26
7
votes
1 answer

Limiting the number of retrieved rows using Fill in ADOMD

The following C# code runs a DAX statement and retrieves a DataTable. This works fine, but now I need to retrieve from the database up to N rows. Is there a way to limit the number of rows returned by the Fill function? If not, how can I retrieve…
ps0604
  • 2,125
  • 16
  • 88
  • 233
7
votes
1 answer

Should FILTER be used inside or outside of SUMMARIZE?

I have these two queries: EVALUATE FILTER ( SUMMARIZE ( 'Sales', Products[ProductName], 'Calendar'[CalendarYear], "Total Sales Amount", SUM ( Sales[SalesAmount] ), "Total Cost", SUM (…
whytheq
  • 31,528
  • 57
  • 155
  • 255
1
2 3
99 100