Browse 543 attributed reviews, viewable separately for our classroom and online training
Using a DAX query to show a table in Power BI
Did you know that you can write an EVALUATE DAX query in software like DAX Studio and then run it from within Power BI to create a new table? You do now!

Posted by Andy Brown on 14 January 2021

You need a minimum screen resolution of about 700 pixels width to see our blogs. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.

Using a DAX query to show a table in Power BI

So here's something I didn't know was possible.  Whether it's useful is another question!  Let's say you've written a DAX query in an application such as DAX Studio:

-- list out a set of rows

EVALUATE

SUMMARIZE(

ADDCOLUMNS(

-- show all the purchases made in London

FILTER(

Purchase,

RELATED(Region[RegionName])="London"

),

-- with an additional column showing the town name

"Town",

RELATED(Town[TownName])

),

-- group by the town name ...

[Town],

-- ... and show total quantity

"Total quantity",

SUM(Purchase[Quantity])

)

When you execute this DAX query, it lists out data from a Power BI data model:

DAX query results

The query shows results like this.

 

You now want to show this as a table in a Power BI report.  To do this, use the New Table button:

New table button

You can find this New table button on the Modeling tab of the ribbon.

Paste in your DAX query, excluding the EVALUATE command at the start:

The DAX table

Your query should now return a table of data in Power BI.

This shows the same table of information! 

Table of data in Power BI

You can now treat this as any other table in Power BI.

 

I would guess that this technique might be useful for people who know the DAX querying language but aren't as familiar with Query Editor.

This blog has 0 threads Add post