Forum Discussion
Cumulative Sum with changing division
Hello,
I'm trying to divide cummulativ sum with value from another column.
I got rigth the cummulativ sum, but if I try to divide it, it divide the whole sum..
Data:
| Calendar Date | SUM_RT | Sum_sales | SUM_RT_w_correction | Sum_sales_correction | MAX_correction | Expected Measure |
| 14.09.2020 | 82800 | 82800 | 82800 | 82800 | 1 | 82800 |
| 01.10.2020 | 82800 | 0 | 82800 | 0 | 1 | 82800 |
| 02.10.2020 | 165600 | 82800 | 165600 | 82800 | 1 | 165600 |
| 05.10.2020 | 165600 | 0 | 165600 | 0 | 1 | 165600 |
| 06.10.2020 | 358800 | 193200 | 358800 | 193200 | 1 | 358800 |
| 12.10.2020 | 358800 | 0 | 358800 | 0 | 1 | 358800 |
| 13.10.2020 | 414000 | 55200 | 414000 | 55200 | 1 | 414000 |
| 15.10.2020 | 552000 | 138000 | 552000 | 138000 | 1 | 552000 |
| 31.05.2021 | 552000 | 0 | 552000 | 0 | 1 | 552000 |
| 01.06.2021 | 607200 | 55200 | 607200 | 55200 | 1 | 607200 |
| 03.06.2021 | 690000 | 82800 | 690000 | 82800 | 1 | 690000 |
| 30.11.2021 | 690000 | 0 | 690000 | 0 | 1 | 690000 |
| 01.12.2021 | 828000 | 138000 | 828000 | 138000 | 1 | 828000 |
| 01.02.2022 | 828000 | 0 | 828000 | 0 | 1 | 828000 |
| 02.02.2022 | 966000 | 138000 | 966000 | 138000 | 1 | 966000 |
| 28.07.2022 | 966000 | 0 | 966000 | 0 | 1 | 966000 |
| 29.07.2022 | 1021200 | 55200 | 1021200 | 55200 | 1 | 1021200 |
| 02.08.2022 | 1048800 | 27600 | 1048800 | 27600 | 1 | 1048800 |
| 30.08.2022 | 1048800 | 0 | 1048800 | 0 | 1 | 1048800 |
| 31.08.2022 | 1131600 | 82800 | 1131600 | 82800 | 1 | 1131600 |
| 07.09.2022 | 1131600 | 0 | 1131600 | 0 | 1 | 1131600 |
| 08.09.2022 | 1186800 | 55200 | 1186800 | 55200 | 1 | 1186800 |
| 20.10.2022 | 1324800 | 138000 | 1324800 | 138000 | 1 | 1324800 |
| 09.12.2022 | 1324800 | 0 | 1324800 | 0 | 1 | 1324800 |
| 12.12.2022 | 1352400 | 27600 | 1352400 | 27600 | 1 | 1352400 |
| 05.01.2023 | 1352400 | 0 | 1352400 | 0 | 1 | 1352400 |
| 06.01.2023 | 1462800 | 110400 | 1462800 | 110400 | 1 | 1462800 |
| 06.03.2023 | 1490400 | 27600 | 1490400 | 27600 | 1 | 1490400 |
| 09.03.2023 | 1545600 | 55200 | 1545600 | 55200 | 1 | 1545600 |
| 22.03.2023 | 1628400 | 82800 | 1628400 | 82800 | 1 | 1628400 |
| 05.04.2023 | 1683600 | 55200 | 1683600 | 55200 | 1 | 1683600 |
| 19.04.2023 | 1683600 | 0 | 1683600 | 0 | 1 | 1683600 |
| 20.04.2023 | 1766400 | 82800 | 1766400 | 82800 | 1 | 1766400 |
| 02.05.2023 | 1876800 | 110400 | 1876800 | 110400 | 1 | 1876800 |
| 12.05.2023 | 1876800 | 0 | 1876800 | 0 | 1 | 1876800 |
| 15.05.2023 | 1959600 | 82800 | 1959600 | 82800 | 1 | 1959600 |
| 22.06.2023 | 1959600 | 0 | 1959600 | 0 | 1 | 1959600 |
| 23.06.2023 | 2014800 | 55200 | 2014800 | 55200 | 1 | 2014800 |
| 25.08.2023 | 2180400 | 165600 | 2180400 | 165600 | 1 | 2180400 |
| 14.09.2023 | 2180400 | 0 | 2180400 | 0 | 1 | 2180400 |
| 15.09.2023 | 2263200 | 82800 | 2263200 | 82800 | 1 | 2263200 |
| 22.09.2023 | 2263200 | 0 | 2263200 | 0 | 1 | 2263200 |
| 25.09.2023 | 2346000 | 82800 | 2346000 | 82800 | 1 | 2346000 |
| 19.10.2023 | 2346000 | 0 | 1173000 | 0 | 2 | 2346000 |
| 20.10.2023 | 2373600 | 27600 | 1186800 | 13800 | 2 | 2359800 |
| 26.10.2023 | 2373600 | 0 | 1186800 | 0 | 2 | 2359800 |
| 27.10.2023 | 2401200 | 27600 | 1200600 | 13800 | 2 | 2373600 |
| 29.11.2023 | 2401200 | 0 | 1200600 | 0 | 2 | 2373600 |
| 30.11.2023 | 2456400 | 55200 | 1228200 | 27600 | 2 | 2401200 |
| 19.01.2024 | 2456400 | 0 | 1228200 | 0 | 2 | 2401200 |
| 22.01.2024 | 2597236,4 | 140836,4 | 1298618,2 | 70418,2 | 2 | 2471618,2 |
| 02.02.2024 | 2597236,4 | 0 | 1298618,2 | 0 | 2 | 2471618,2 |
| 05.02.2024 | 2653570,96 | 56334,56 | 1326785,48 | 28167,28 | 2 | 2499785,48 |
The cummulative sum measure and with the division in the graph:
The sum_sales_correction column has the rigth values, but I'm not able to sum them.
Can you please help me?
Thank you very much.
SUM_RT_w_correction =
CALCULATE(
SUM('LISA PBI Development of Sales'[Sales])/[MAX_correction],
FILTER(
ALL('LISA PBI Development of Sales'[Calendar day.Calendar day Level 01]),
'LISA PBI Development of Sales'[Calendar day.Calendar day Level 01] <= MAX('LISA PBI Development of Sales'[Calendar day.Calendar day Level 01]) &&
'LISA PBI Development of Sales'[Calendar day.Calendar day Level 01] >= MAX('PPC Project Materials'[Start of contract])
)
)MAX_correction =
CALCULATE(
MAX(Korekce[Hodnota]),
FILTER(
ALL(Korekce[Atribut]),
Korekce[Atribut] <= MAX('LISA PBI Development of Sales'[Calendar day.Calendar day Level 01])
)
)
Hello,
I solved the problem. I used this measure:_Divide SUM = SUMX(Values('LISA PBI Development of Sales'[Calendar day.Calendar day Level 01]), Divide([Sum_sales],[MAX_correction]))Inside the cummulative measure:
SUM_RT_w_correction = CALCULATE( [_Divide SUM], FILTER( ALL('LISA PBI Development of Sales'[Calendar day.Calendar day Level 01]), 'LISA PBI Development of Sales'[Calendar day.Calendar day Level 01] <= MAX('LISA PBI Development of Sales'[Calendar day.Calendar day Level 01]) && 'LISA PBI Development of Sales'[Calendar day.Calendar day Level 01] >= MAX('PPC Project Materials'[Start of contract]) ) )Result in graph:
Have a nice day.
2 Replies
- lbendlin
Super User
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information or anything not related to the issue or question.
If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
Please show the expected outcome based on the sample data you provided.
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523 - stepantuzilRegular Visitor
Hello,
I solved the problem. I used this measure:_Divide SUM = SUMX(Values('LISA PBI Development of Sales'[Calendar day.Calendar day Level 01]), Divide([Sum_sales],[MAX_correction]))Inside the cummulative measure:
SUM_RT_w_correction = CALCULATE( [_Divide SUM], FILTER( ALL('LISA PBI Development of Sales'[Calendar day.Calendar day Level 01]), 'LISA PBI Development of Sales'[Calendar day.Calendar day Level 01] <= MAX('LISA PBI Development of Sales'[Calendar day.Calendar day Level 01]) && 'LISA PBI Development of Sales'[Calendar day.Calendar day Level 01] >= MAX('PPC Project Materials'[Start of contract]) ) )Result in graph:
Have a nice day.