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
Gus_C
Frequent Visitor

Percent of total client sales

Hi All,

 

I am trying to get a percentage of total value of sales per client for my line chart.

 

However, the percentage of total in the field option is giving me the percentage out of the filtered top N clients. But I want to get percentage out of all clients in that particular time period (sliced by month and year). (i.e I do not want topN to affect percentage).

 

My bar and line chart should show top 10 clients sales values (bar) and their percentage of sales (line) out of all clients in that sliced date. But im getting percentage of sales out of top 10 clients. 

 

I have tried:

 

=divide([my sales measure],calculate([my salesmeasure],all(table[client group])))

 

but to no avail. I either get 100% for all clients or the same as Grand total.

 

p.s I cannot find percent of column total (as some other solutions have suggested, not sure if thats whats needed anyway)

 

Thanks a lot for the help!

1 ACCEPTED SOLUTION

@Gus_C that's what the "all" function should be doing, so without seeing more details I can't speculate as to why that's not working.

I've tested the below measure in a similar scenario, with test data.  It seems to perform as expected.

% of Total Sales = 
VAR _Sales = [Sales]
VAR _TotalSales = CALCULATE([Sales],ALL(financials[Country]))
VAR _Result = DIVIDE(_Sales, _TotalSales)
Return
_Result

ebeery_0-1628551741537.png

 

ebeery_1-1628551767344.png

 

View solution in original post

3 REPLIES 3
ebeery
Solution Sage
Solution Sage

@Gus_C  is [client group] the column you're applying the top N filter to?

If not, that would explain why the ALL() function is not performing as desired.

Do you have a client table?  Can you just filter ALL(clienttable) in your CALCULATE statement instead of the specific column?

Without seeing your data model or data structure it's hard to give any more specific advice.

Gus_C
Frequent Visitor

Thanks for your reply @ebeery ,

 

Yeah I am applying top N filter to [client group] by value of their sales ([sales measure]), cant share pbix due to confidentiality unfortunately.

 

Is there a way to prevent topN filter affecting this percentage measure? that way it would take whole column rather than top N clients?

 

 

 

 

@Gus_C that's what the "all" function should be doing, so without seeing more details I can't speculate as to why that's not working.

I've tested the below measure in a similar scenario, with test data.  It seems to perform as expected.

% of Total Sales = 
VAR _Sales = [Sales]
VAR _TotalSales = CALCULATE([Sales],ALL(financials[Country]))
VAR _Result = DIVIDE(_Sales, _TotalSales)
Return
_Result

ebeery_0-1628551741537.png

 

ebeery_1-1628551767344.png

 

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.