The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello everyone.
I have the following data:
FLVR | ITEM_SAP | Fecha Semana | #Semana | Calculo INV final |
CHOCOLATE | 300033915 | 10/09/2022 | 0 | 547 |
CHOCOLATE | 300033915 | 17/09/2022 | 1 | 177 |
CHOCOLATE | 300033915 | 24/09/2022 | 2 | -11 |
CHOCOLATE | 300033915 | 01/10/2022 | 3 | 383 |
CHOCOLATE | 300033916 | 10/09/2022 | 0 | 240 |
CHOCOLATE | 300033916 | 17/09/2022 | 1 | 7 |
CHOCOLATE | 300033916 | 24/09/2022 | 2 | 8 |
CHOCOLATE | 300033916 | 01/10/2022 | 3 | -92 |
CHOCOLATE | 300033918 | 10/09/2022 | 0 | 2101 |
CHOCOLATE | 300033918 | 17/09/2022 | 1 | 222 |
CHOCOLATE | 300033918 | 24/09/2022 | 2 | -61 |
CHOCOLATE | 300033918 | 01/10/2022 | 3 | -21 |
As you can see, there are 3 different codes (ITEM SAP) and each week (from 0 to 3) has a different value for it.
I try to apply a cumulative sum with DAX for each of the codes and I get the following result:
I used the following formula:
INV Final = CALCULATE(SUMX('table',[Calculate INV final]), FILTER(ALL('table'), 'table'[#Week] <= MAX('table'[#Week]))))
This is the desired result. However, I am looking for a second view where the codes are grouped ("ITEM SAP"), summing the value of the 3 codes for each week. As follows:
The goal is that a cumulative sum can also be performed by FLVR. But leaving the same formula, the result is not the desired one.
I also tried with the following formula:
INV Final Flvr = CALCULATE([Calculate INV final], FILTER(ALL('table'), 'table'[#Week] <= MAX('table'[#Week])))).
But I get this result:
Idon't understand where is the error. Please help me to solve this.
Thank you,
Sabrina H.
Solved! Go to Solution.
Hi @Anonymous ,
Please try this:
INV final =
CALCULATE (
SUM ( 'Table'[Calculo INV final] ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[FLVR], 'Table'[ITEM_SAP] ),
[#Semana] <= MAX ( 'Table'[#Semana] )
)
)
result:
Pbix in the post you created
Suma acumulada con una agrupación de datos - Microsoft Power BI Community
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
Please try this:
INV final =
CALCULATE (
SUM ( 'Table'[Calculo INV final] ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[FLVR], 'Table'[ITEM_SAP] ),
[#Semana] <= MAX ( 'Table'[#Semana] )
)
)
result:
Pbix in the post you created
Suma acumulada con una agrupación de datos - Microsoft Power BI Community
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
User | Count |
---|---|
5 | |
5 | |
2 | |
2 | |
2 |
User | Count |
---|---|
10 | |
7 | |
4 | |
4 | |
4 |