Forum Discussion
Running Total on Measure on a Measure
- Anonymous2 years ago
Hi DrillDownBI ,
I created some data:
Whether your [YearWeek] is in text format or not, you can create an Index to be used as a sorting sequence for cumulative calculations.
Here are the steps you can follow:
1. Create calculated column.
Rank = RANKX( 'Table','Table'[Date],,ASC)Index = MAXX( FILTER('Table','Table'[YearWeek]=EARLIER('Table'[YearWeek])),[Rank])2. Create calculated table.
Table 2 = SUMMARIZE( 'Table','Table'[YearWeek],'Table'[Index])3. Joining a relationship between two tables.
4. Show the expression order_IO_Prod in a separate measure.
5. Create measure.
True = var _today=TODAY() var _todayindex=MAXX(FILTER(ALL('Table 2'),'Table 2'[YearWeek]=FORMAT(_today,"YYYY-WW")),[Index]) return SUMX( FILTER(ALLSELECTED('Table 2'), 'Table 2'[Index]>_todayindex&&'Table 2'[Index]<=MAX('Table 2'[Index])),[order_IO_Prod])6. Result:
If it doesn't meet your desired outcome, can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi DrillDownBI ,
I created some data:
Whether your [YearWeek] is in text format or not, you can create an Index to be used as a sorting sequence for cumulative calculations.
Here are the steps you can follow:
1. Create calculated column.
Rank =
RANKX(
'Table','Table'[Date],,ASC)
Index =
MAXX(
FILTER('Table','Table'[YearWeek]=EARLIER('Table'[YearWeek])),[Rank])
2. Create calculated table.
Table 2 =
SUMMARIZE(
'Table','Table'[YearWeek],'Table'[Index])
3. Joining a relationship between two tables.
4. Show the expression order_IO_Prod in a separate measure.
5. Create measure.
True =
var _today=TODAY()
var _todayindex=MAXX(FILTER(ALL('Table 2'),'Table 2'[YearWeek]=FORMAT(_today,"YYYY-WW")),[Index])
return
SUMX(
FILTER(ALLSELECTED('Table 2'),
'Table 2'[Index]>_todayindex&&'Table 2'[Index]<=MAX('Table 2'[Index])),[order_IO_Prod])
6. Result:
If it doesn't meet your desired outcome, can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly