Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Uniqueusername
Helper II
Helper II

DAX engine under the hood- dax measure vs dax query terminology

Hi,

 

I have been exploring DAX Studio to gain a better understanding of what happens under the hood in a Power BI report. I'm curious about why an SQL query is generated when a DAX formula is executed.

 

Additionally, I've encountered the terms "DAX Formula" and "DAX Query" being used interchangeably in some resources, while in others, there seems to be a distinction between them. Please correct me if I'm mistaken. As far as I understand it, a "DAX formula" is what you write as a measure. In other words, "DAX Formula = DAX Measure."

 

On the other hand, a "DAX Query" is what generates the DAX formula. Are these the "Evaluate" and "Define" keywords we see in DAX Studio?

 

Also, why is there an SQL query generated with every DAX measure (or is "DAX Query" the correct term) ?

1 ACCEPTED SOLUTION

Eventually, yes.  It will return a table (or multiple tables) to the renderer, indicating which values should go where (especially if row or column totals are involved).

 

This means for you as a visual designer that you want to be frugal with the number of fields you put into a visual.  It might be tempting to load up the tootips aea (for example) but that all adds to the query cost.

View solution in original post

6 REPLIES 6
Uniqueusername
Helper II
Helper II

Here is a sample data I created using the EnterData feature in power bi and a simple sum measure

Measure = SUM ( 'Table'[Value])

 

Uniqueusername_1-1711163719453.png

 

Looking into DAX studio this is what I get

Uniqueusername_2-1711163846736.png

So it does look like there is an SQL query running in the back ground. I haven't used any power query transformations in this nor is it Direct query

 

I thought query folding kicks in only when the datasource is some sort of a database such as an SQL server

Ah, ok, you are looking at the VertiPaq queries. Yes, the DAX queries are internally translated into SQL-like queries against the SSAS Tabular storage. But these are purely internal and not something you can write directly.

thank you. And what about the code that DAX Studio generates ? That is the query which creates the visual ?

Eventually, yes.  It will return a table (or multiple tables) to the renderer, indicating which values should go where (especially if row or column totals are involved).

 

This means for you as a visual designer that you want to be frugal with the number of fields you put into a visual.  It might be tempting to load up the tootips aea (for example) but that all adds to the query cost.

thank you. That clears things up. I am sure I will have more questions as I dive deeper into DAX studio. Until then, I will mark this as solved

lbendlin
Super User
Super User

I'm curious about why an SQL query is generated when a DAX formula is executed.

 

Read about Query Folding

 

As far as I understand it, a "DAX formula" is what you write as a measure. In other words, "DAX Formula = DAX Measure."

That is incorrect.  A DAX formula in the vast majority of cases returns a table. A measure can only return a scalar value.

Also, why is there an SQL query generated with every DAX measure (or is "DAX Query" the correct term) ?

Not with every query.  Only with Direct Query and Query folding.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.