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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Asish24
New Member

How to run multiple table generation commands at once?

I want to find the top 5 highest values of a column and generate an individual table for each value, like highest, 2nd highest, 3rd highest and so on....

As DAX doesn't have iteration functions, and multiple commands can't be executed in one go I am unable to do the above mentioned task.

 

I'm using the below mentioned command 5 times by changing the value of M from 1 to 5 to get the desired 5 tables, how to get them at once?

NewTable = TOPN(1, FILTER(ALL(TableName), RANKX(ALL(TableName) , TableName[ColumnName])= M),

TableName[ColumnName])

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks @lbendlin 

Hi, @Asish24 

Do you mean to automatically generate 5 separate calculated tables? There are no similar batch commands in Power BI for the time being. As you mentioned, make 5 copies of the formula, using one copy in each calculation table. If you need a table similar to the Cartesian product, you can use the formula provided by lbendlin, which will be very portable to generate a Cartesian product table. Something like this is shown in the figure below:

table1:

vjianpengmsft_1-1712727882923.png

 

table2:

vjianpengmsft_2-1712727895240.png

Use GENERATE():

vjianpengmsft_0-1712727830763.png

 

 

 

 

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

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

 

 

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Thanks @lbendlin 

Hi, @Asish24 

Do you mean to automatically generate 5 separate calculated tables? There are no similar batch commands in Power BI for the time being. As you mentioned, make 5 copies of the formula, using one copy in each calculation table. If you need a table similar to the Cartesian product, you can use the formula provided by lbendlin, which will be very portable to generate a Cartesian product table. Something like this is shown in the figure below:

table1:

vjianpengmsft_1-1712727882923.png

 

table2:

vjianpengmsft_2-1712727895240.png

Use GENERATE():

vjianpengmsft_0-1712727830763.png

 

 

 

 

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

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

 

 

 

lbendlin
Super User
Super User

That's what GENERATE() is for.

 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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