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
Amrselim1989
Helper II
Helper II

Rank & Rankx for calculated column in calculated table

Dear Guys,

 

kindly note i have calculated table which is i summerize sales by product name in it, so fine so far 

after this i used new column to calculate a column 

Rank Net Sales = RANKX ( 'Products Header', [Header Total Sales],, DESC, DENSE )
so fine so far 
 
but the problem starts now, i want to rank the product category depending on total sales for this category and I have to put it in the same calculated table just like below 
 
 
Amrselim1989_1-1687841739551.png

 

 

any help?!

1 ACCEPTED SOLUTION

i found my solution 

Rank by category = RANKX(ALL('Products Header'[BRAND_NAME]), CALCULATE(sum('Products Header'[Total Net Sale]),ALLEXCEPT('Products Header','Products Header'[BRAND_NAME])),,DESC,Dense)
 
thank you
 

View solution in original post

6 REPLIES 6
devanshi
Helper V
Helper V

Total Sales = SUM([Sales])

Category Ranks = RANKX(ALL('Table'),[Total Sales],Desc)

some_bih
Super User
Super User

Hi @Amrselim1989 your measure to rank sales by category could be

Rank by category=RANKX(ALL(Table1[Category]); CALCULATE(SUM(Table1[Sales]));;DESC)

Adjust Table1 to your table name

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

some_bih_0-1687845495784.png

 





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

Proud to be a Super User!






unfortunately, it doesn't work, it only gives me two values instead of four.

there a screen shot if i make a sperate table for brand and i ranked it

Amrselim1989_0-1687846565896.png

but i can't rank it in the details table based on the summation of brand sales

 

Amrselim1989_1-1687846648211.png

Amrselim1989_2-1687846713842.png

 

any help??!

 

Hi @Amrselim1989 my solution is measure. Go to your pivot table and put this measure into pivot table and check results.





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

Proud to be a Super User!






i found my solution 

Rank by category = RANKX(ALL('Products Header'[BRAND_NAME]), CALCULATE(sum('Products Header'[Total Net Sale]),ALLEXCEPT('Products Header','Products Header'[BRAND_NAME])),,DESC,Dense)
 
thank you
 

No, i don't want it as a measure it must be a calculated column, it must be a calculated column for other purposes

thank you for your patience. 

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.

Top Solution Authors