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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
dvn_charles
Frequent Visitor

Can you use a list created in power query within a Dax variable

Hi Guys 

 

Can you use a list created in power query within a Dax variable

Example: In power query(M) convert a table to a list. Then reference that list as string variable in Dax

 

Kind regards

Devon

7 REPLIES 7
CNENFRNL
Community Champion
Community Champion

Any legit data type in PQ (list, record, number, text ...) is automatically converted to table when loaded into data model used by DAX.


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

PaulDBrown
Community Champion
Community Champion

Can you provide sample data and a depiction of what you are trying to do? There are table functions which can be used in variables, measures and to create new tables. 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






@PaulDBrown @CNENFRNL 

 

I am trying to accomplish something like the below:

Test Measure Output =
VAR TableVar =
SUMMARIZECOLUMNS ( 'Measure List'[--Dax_Statement] )
RETURN
CALCULATETABLE(
UNION(
TableVar
))

Where that table variable would be a table of  "select columns"

Hi  @dvn_charles ,

 

I agree with CNENFRNL , your list will be convert to table automatically in Report View. 

Here I convert Table2 to a List.

RicoZhou_0-1649756214415.png

List has been converted to a table automatically in Report View.

RicoZhou_1-1649756229723.png

So you can use it to calculate in your calculation. I have checked your code, and I think it won't be a measure. It should be a calculated table.

There should be two tables in UNION function, so your code will return an error.

It should look like as below.

Test Measure Output =
VAR TableVar =
SUMMARIZECOLUMNS ( 'Measure List'[--Dax_Statement] )
RETURN
CALCULATETABLE(
UNION(
Table1,
TableVar
))

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

It would be a much more useful help comment if you would show examples of referencing items in the list/table using an Index with DAX syntax and include the output.

dvn_charles
Frequent Visitor

Are there data structures available in Dax?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.