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.
I was able to calculate the cumulative total without a group, but when I need per group, it did not work. I tried a couple of formulas I found in the internet such as:
Cumulative Total =
CALCULATE(
SUM('Table1'[Revenue]),
FILTER(
ALL('Table1'),
EARLIER('Table1'[Group]) = 'Table1'[Group]
&& 'Table1'[Index]
<=EARLIER('Table1'[Index] )
)
)
or:
**bleep** Sales column per filial =
CALCULATE(
SUM('Table1'[Revenue]),
FILTER(
ALLEXCEPT('Table1', 'Table1'[Group]),
'Table1'[Index]<=EARLIER('Table1'[Index] )
)
)
But obtained the wrong result...
In Power Query I sorted the table by Group and Revenue. Then I added an index per group. Now I would like to calculate the Cumulative Total but I don't know how.
Currently my table looks like this (without the Cumulative Total):
Group | Product | Revenue | Index | Cumulative Total | ||||
1 | Product1 | 25000 | 1 | 25000 | ||||
1 | Product2 | 14000 | 2 | 39000 | ||||
1 | Product3 | 14000 | 3 | 53000 | ||||
1 | Product4 | 11000 | 4 | 64000 | ||||
2 | Product5 | 13500 | 1 | 13500 | ||||
2 | Product2 | 9000 | 2 | 22500 | ||||
2 | Product6 | 7500 | 3 | 30000 |
The end goal is to calculate the ABC classification. Can you please help me?
Solved! Go to Solution.
@jessicarocha , Try a new measure
CALCULATE(
SUM('Table1'[Revenue]),
FILTER(
allselected('Table1'),
'Table1'[Index]<=max('Table1'[Index] ) && 'Table1'[Group]=max('Table1'[Group] )
)
)
or a new column
CALCULATE(
SUM('Table1'[Revenue]),
FILTER(
('Table1'),
'Table1'[Index]<=EARLIER('Table1'[Index] ) && 'Table1'[Group]=EARLIER('Table1'[Group] )
)
)
@jessicarocha , Try a new measure
CALCULATE(
SUM('Table1'[Revenue]),
FILTER(
allselected('Table1'),
'Table1'[Index]<=max('Table1'[Index] ) && 'Table1'[Group]=max('Table1'[Group] )
)
)
or a new column
CALCULATE(
SUM('Table1'[Revenue]),
FILTER(
('Table1'),
'Table1'[Index]<=EARLIER('Table1'[Index] ) && 'Table1'[Group]=EARLIER('Table1'[Group] )
)
)
HI @amitchandak ,
I did not realised that my Index column was being read as "text" format and not "number". That's why it was giving wrong results. Anyway, thanks for trying to help me out!
Hi @amitchandak . Thank you for the reply.
I tried the formula for the column but I get the same value as with the formulas I wrote in my question...
I realised that I forgot to include the product in the table, could this be influencing the result?
as a measure it does not works for me because the dataset is big and the calculation becomes too slow...
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |