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
Mister_T
Advocate I
Advocate I

Cumulative percentage based on sub-groups (filterable)

Dear community,

for the following task, I was able to find some solutions for some single steps, but unfortunately did not manage to combine those for reaching my desired goal. I hope you can help.

I have the following data table 'Reseller Revenue':

 

Reseller_Revenue.png

Reseller Sales_CountryRevenue [EUR]
A-CompanyRussian Federation310.731
A-CompanyUnited States205.094
A-CompanyGermany35.000
B-CompanyBrazil159.500
C-CompanyFrance128.660
C-CompanyBrazil108.000
C-CompanyRussian Federation33.600
D-CompanyGermany105.730
D-CompanyBrazil104.219
D-CompanyUnited States96.392
D-CompanyIndia88.748
D-CompanyItaly27.090
E-CompanyBrazil104.219
E-CompanyGermany76.600
E-CompanyFrance13.680
F-CompanyRussian Federation78.290
F-CompanyGermany53.200
F-CompanyItaly30.000
F-CompanyUnited States29.666
G-CompanyFrance52.500
H-CompanyGermany48.270
H-CompanyCanada13.245
I-CompanyFrance35.000
J-CompanyAustria12.630
K-CompanyFrance4.290
   
 Total1.954.353

 

Now, I want to get a table visual as shown below, which automaticaly updates in case I am for example filtering only for specific sales countries in the original table (for example all countries except United States):

Revenue_per_Reseller.png


Could you please help me in drafting the steps I have to take? Especially the cumulative sum of the percentages of the summarized revenue per reseller is giving me a hard time so far.

Thank you very much for your support!

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @Mister_T 

Please try my measure.

% of Total = 
VAR _Sum = SUM('Reseller Revenue'[Revenue [EUR]]])
VAR _Total = SUMX(ALLSELECTED('Reseller Revenue'),'Reseller Revenue'[Revenue [EUR]]])
Return
DIVIDE(_Sum,_Total)
Cumulative = 
VAR b =
    ADDCOLUMNS (
        CALCULATETABLE (
            VALUES ( 'Reseller Revenue'[Reseller ] ),
            ALL ( 'Reseller Revenue'[Reseller ] )
        ),
        "_1", [% of Total]
    )
VAR a = [% of Total]
RETURN
    SUMX ( FILTER ( b, [_1] >= a ), [_1] )

Result is as below.

1.png

 

Best Regards,

Rico Zhou

 

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

4 REPLIES 4
v-rzhou-msft
Community Support
Community Support

Hi @Mister_T 

Please try my measure.

% of Total = 
VAR _Sum = SUM('Reseller Revenue'[Revenue [EUR]]])
VAR _Total = SUMX(ALLSELECTED('Reseller Revenue'),'Reseller Revenue'[Revenue [EUR]]])
Return
DIVIDE(_Sum,_Total)
Cumulative = 
VAR b =
    ADDCOLUMNS (
        CALCULATETABLE (
            VALUES ( 'Reseller Revenue'[Reseller ] ),
            ALL ( 'Reseller Revenue'[Reseller ] )
        ),
        "_1", [% of Total]
    )
VAR a = [% of Total]
RETURN
    SUMX ( FILTER ( b, [_1] >= a ), [_1] )

Result is as below.

1.png

 

Best Regards,

Rico Zhou

 

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

Thank you so much @v-rzhou-msft! It works!

I was sitting at this problem for a long time, but thanks to your help I finally have a solution.

Thanks again and best regards,

Mister_T

Vera_33
Resident Rockstar
Resident Rockstar

Hi @Mister_T 

 

When you filter down to 4 countries, you calculate against the Grand Total of whole table or the 4 countries you select? Here is one against the whole table

 

Cumulative = 
VAR CurReseller = SELECTEDVALUE('Table'[Reseller ])
VAR Cur = CALCULATE([% of Total],'Table'[Reseller ]=CurReseller)
RETURN
CALCULATE([% of Total],FILTER(ALL('Table'[Reseller ]),[% of Total]>=Cur))

  

Hi @Vera_33,

thank you very much for your reply!

When I filter down to a specific set of countries, the percentage of each reseller should then be in relation to the total of the chosen selection of countries.

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.