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
termini
New Member

RANK, TOP N - CORRECT SUM IN THE TABLE

Hi All,

Please help me with the correct sum in the table. While using rank I would like to see sum only for selected products. Thx. SCREEN_PBI.JPG

1 ACCEPTED SOLUTION
termini
New Member

I have managed with it already by such measure:

CORRECT SUM = if(int([HAS_ONE_VALUE_?])=1,[RANK IF],SUMX(VALUES(Table1[product]),[RANK IF]))

View solution in original post

4 REPLIES 4
termini
New Member

I have managed with it already by such measure:

CORRECT SUM = if(int([HAS_ONE_VALUE_?])=1,[RANK IF],SUMX(VALUES(Table1[product]),[RANK IF]))
Shaurya
Memorable Member
Memorable Member

Hi @termini,

 

I am not exactly sure why you are using the TopN table but I used these formulas to replicate your data:

 

Rank by Sales = RANKX('Table','Table'[Value],,DESC)

 

Rank If = IF('Table'[Rank by Sales]<=3,'Table'[Value])

 

I used these two along with the Product and Value column and got the right total.

 

Screenshot 2022-10-24 162149.jpg

 

Works for you? Mark this post as a solution if it does!
Consider taking a look at my blog: Forecast Period - Previous Forecasts

unfortunatelly this measure 

Rank by Sales = RANKX('Table','Table'[Value],,DESC)

gives me rank of 1 in each line (for each product)

Rank2.JPG

Hi , @termini 

For your rankx , you need to use this dax :

Rank by Sales= RANKX( ALL('Table'[product]) ,CALCULATE( SUM('Table'[val])),,DESC)

 

Best Regards,

Aniya Zhang

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

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.