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
bikelley
Helper IV
Helper IV

Wrong amount of grand total TOP N function?

Hello, 


Can anybody please tell me why my Top4 grand total is wrong? It should be 7488993, but now showing as 3659706. Because of this I will get the wrong answer on Grand total Cumulated MS, it should be HIGH as well. Please see below for my formal and sample attached file. I am confused. 

 

 

Top4 = CALCULATE(SUM(SuppliersBySegment[Total]), TOPN(4, SuppliersBySegment, SuppliersBySegment[Total], DESC))
SuppliersBySegment_Total = SUM(SuppliersBySegment[Total])
Test_% = [Top4]/[SuppliersBySegment_Total]

CUMULATED MS = 
VAR top4 = [Top4]/SuppliersBySegment[SuppliersBySegment_Total]
RETURN(
    IF (
        top4 >= 0.75, 
        "HIGH",
        IF (
            top4 >= 0.61,
            "MODERATE",
            IF(top4>0, "LOW", BLANK())
            )
        )
)

 

As you can see below Top4 should be 7488993 and Test_% should be 0.82 and CUMULATED MS should be HIGH 

Capture.PNG

Sample File- 

https://drive.google.com/file/d/1ZFVhy-pvMrs-GYkUq-310YFXNRjs0Kpu/view?usp=sharing 

 

Thank you so much

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@bikelley , Try like

Top4 = CALCULATE(SUM(SuppliersBySegment[Total]), TOPN(4, SuppliersBySegment, SuppliersBySegment[Total], DESC), VALUES(SuppliersBySegment[market Segment]))

 

or Try like

 

CALCULATE(SUM(SuppliersBySegment[Total]), TOPN(4, ALLSELECTED(SuppliersBySegment[MarketSegment]), CALCULATE(sum(SuppliersBySegment[Total])), DESC),VALUES(SuppliersBySegment[MarketSegment]))

View solution in original post

4 REPLIES 4
bikelley
Helper IV
Helper IV

@amitchandak  Thank you so much, second one wroks well. I appricate your help. 

amitchandak
Super User
Super User

@bikelley , Try like

Top4 = CALCULATE(SUM(SuppliersBySegment[Total]), TOPN(4, SuppliersBySegment, SuppliersBySegment[Total], DESC), VALUES(SuppliersBySegment[market Segment]))

 

or Try like

 

CALCULATE(SUM(SuppliersBySegment[Total]), TOPN(4, ALLSELECTED(SuppliersBySegment[MarketSegment]), CALCULATE(sum(SuppliersBySegment[Total])), DESC),VALUES(SuppliersBySegment[MarketSegment]))

@amitchandak  Tahnk you so much  for the quick reposnd, but it did not work. Still the same. Any other suggestions? 
Capture.PNG

@bikelley , check the attached file and see if that can help

 

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.