Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hello,
I want to calculate the % share of each months sale over the total sale for each year in the following visual:
So for example the total sales for the year 2020 was 479.39 M.
Hence January months' share towards the total sale in 2020 would be : 6.90%.
Can someone help me?
Solved! Go to Solution.
add that category column in the allexcept, check the below
Sales % =
VAR _sumOfSales = SUM(Sales[Sales])
VAR _totalSales = CALCULATE(
SUM(financials[ Sales]),ALLEXCEPT(financials,financials[Year],financials[Segment]))
VAR _result = DIVIDE([Sum of Sales],_totalSales)
RETURN _result
Thanks,
Arul
Hope this helps:
modify this based on your need and try,
Sales % =
VAR _sumOfSales = SUM(Sales[Sales])
VAR _totalSales = CALCULATE(
SUM(financials[ Sales]),ALL(financials))
VAR _result = DIVIDE([Sum of Sales],_totalSales)
RETURN _result
Thanks,
Arul
Hello,
Thanks for your reply. But I am not getting the correct output with this measure.
For example the % share for January 2020 should have been 6.9% but its coming to be 2.34% with your measure.
there is a small changes in the formula. Can you modify and try this formula now?
Instead of ALL use ALLEXCEPT('MyTable',MyTable[Year])
)
Sales % =
VAR _sumOfSales = SUM(Sales[Sales])
VAR _totalSales = CALCULATE(
SUM(financials[ Sales]),ALLEXCEPT(financials,financials[Year]))
VAR _result = DIVIDE([Sum of Sales],_totalSales)
RETURN _result
Thanks,
Arul
Hello @Arul
Thanks again for your solution its working only with one exception. I have a page level categorical filter. And when I select a category in that filter it doesn't gets applied to the measure. How to handle that?
add that category column in the allexcept, check the below
Sales % =
VAR _sumOfSales = SUM(Sales[Sales])
VAR _totalSales = CALCULATE(
SUM(financials[ Sales]),ALLEXCEPT(financials,financials[Year],financials[Segment]))
VAR _result = DIVIDE([Sum of Sales],_totalSales)
RETURN _result
Thanks,
Arul
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
87 | |
83 | |
82 | |
67 | |
49 |
User | Count |
---|---|
135 | |
111 | |
100 | |
65 | |
62 |