cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

New Member

## Ungroup a Running total

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:

Thank you,

Sabrina H.

1 ACCEPTED SOLUTION
Community Support

``````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.

Community Support

``````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.