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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
pravkan
Frequent Visitor

DAX create calulated table with a specific column name and measures

I have a sales table with below columns 

pravkan_0-1657046343358.png


And I want to create a calculated table that will store bottom n retailer sales per product with the following columns 

  1. Retailer Name
  2. Product Sub Category Name 
  3. Total Sales 

How can I achive this result?



1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @pravkan ,

 

I have built a data sample, please try to add two columns:

Rank Flag = RANKX('Table',[Total each Retailer],,ASC,Dense) *10+
RANKX(FILTER('Table',[Total each Retailer]=EARLIER('Table'[Total each Retailer])),[RETAILER_NAME],,ASC,Dense)
Final Rank = RANKX('Table',[Rank Flag],,ASC,Dense)

Output:

Eyelyn9_0-1659516013709.png

 

Best Regards,
Eyelyn Qin
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

5 REPLIES 5
Anonymous
Not applicable

Hi @pravkan ,

 

I have built a data sample, please try to add two columns:

Rank Flag = RANKX('Table',[Total each Retailer],,ASC,Dense) *10+
RANKX(FILTER('Table',[Total each Retailer]=EARLIER('Table'[Total each Retailer])),[RETAILER_NAME],,ASC,Dense)
Final Rank = RANKX('Table',[Rank Flag],,ASC,Dense)

Output:

Eyelyn9_0-1659516013709.png

 

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

Ashish_Mathur
Super User
Super User

Hi,

Share data in format that can be pasted in an MS Excel file.  On that data, please also show the expected result very clearly.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur ,

 

This what I want to achieve with Power BI

 

pravkan_0-1657625902337.png

 

I have a table called V_BOTTOM_SALES and I want to create a measure that will rank my bottom n retailer with their product subcategory.

 

I don't know if this is possible in dax?

Please read my previous post.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
ryan_mayu
Super User
Super User

@pravkan 

you can try this

Table 2 = 
VAR tbl=TOPN(3,'Table','Table'[sales],ASC)
return SELECTCOLUMNS(tbl,"retailer",'Table'[Retiler_name],"product",'Table'[product],"sales",'Table'[sales])

pls see the attachment below

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.