Forum Discussion

klehar's avatar
klehar
Helper V
4 years ago
Solved

Running Total at drill down doesnt work

Hi,

 

I have a bar + line chart that shows Year and Quarter at one level and Week at drill down level.

I want that the running total line that shows right values at the year quarter level shold also show the right values at week level.

How can i make sure i get the right values?

 

 

Running total calculation

 

Profit running total in Year Quarter = 
CALCULATE(
	SUM('Table'[Profit]),
	FILTER(
		ALLSELECTED('Table'[Year Quarter]),
		ISONORAFTER('Table'[Year Quarter], MAX('Table'[Year Quarter]), DESC)
	)
)

 

 

Data used above:

 

Year QuarterWeakProfit
2020Q1WK114
2020Q1WK215
2020Q1WK310
2020Q1WK415
2020Q2WK112
2020Q2WK212
2020Q2WK318
2020Q2WK411
2020Q3WK112
2020Q3WK210
2020Q3WK310
2020Q3WK419
2020Q4WK111
2020Q4WK212
2020Q4WK311
2020Q4WK415

 

  • Hi klehar your issue is that you are making the calculation only at quarter level so you are not abble to get the week level calculation correct.

     

    Try to do the following steps:

    • Create a new column:
    Year + Q + W = 'Table'[Year Quarter]&'Table'[Weak]

     

    • Change your measure to:
    Profit running total in Year Quarter = 
    CALCULATE(
    	SUM('Table'[Profit]),
    	FILTER(
    		ALLSELECTED('Table'[Year Quarter], 'Table'[Weak],'Table'[Year + Q + W]),
    		ISONORAFTER('Table'[Year + Q + W], MAX('Table'[Year + Q + W]), DESC)
    	)
    )

     

    Result below and in attach PBIX file.

     

     

1 Reply

  • Hi klehar your issue is that you are making the calculation only at quarter level so you are not abble to get the week level calculation correct.

     

    Try to do the following steps:

    • Create a new column:
    Year + Q + W = 'Table'[Year Quarter]&'Table'[Weak]

     

    • Change your measure to:
    Profit running total in Year Quarter = 
    CALCULATE(
    	SUM('Table'[Profit]),
    	FILTER(
    		ALLSELECTED('Table'[Year Quarter], 'Table'[Weak],'Table'[Year + Q + W]),
    		ISONORAFTER('Table'[Year + Q + W], MAX('Table'[Year + Q + W]), DESC)
    	)
    )

     

    Result below and in attach PBIX file.