cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills 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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors