Forum Discussion
Running Total Help
- 4 years ago
Hi All
I believe I have found a nice solution to my query.
I came across this great article https://www.sqlbi.com/articles/hiding-future-dates-for-calculations-in-dax/
So I followed the 2 methods described.
I created a calculated column in the Dates table:
DatesWithProdVals = 'Dates'[CurDate] <= MAX ( DailyProd[pdate] )This column had a value of True up to and including the maximum production date.
I then created the following measure:
Sales YTD v1 = CALCULATE ( [CY Daily Prod Value], CALCULATETABLE ( DATESYTD ( Dates[CurDate],"30/06" ), Dates[DatesWithProdVals] = TRUE ) )This measure gave me exactly what i wished.
I also followed the described procedure without creating a calculated column:
Sales YTD v2 = VAR LastDayAvailable = CALCULATE ( MAX ( DailyProd[pdate] ), ALL ( DailyProd ) ) VAR FirstDayInSelection = MIN ( 'Dates'[CurDate] ) VAR ShowData = (FirstDayInSelection <= LastDayAvailable) RETURN IF ( ShowData, CALCULATE ( [CY Daily Prod Value], DATESYTD ( 'Dates'[CurDate],"30/06" ) ) )This again produced the running ytd values for only July - December. However this measure does not display a total value (see table below). I don't know why.
YTD Table
Thanks everyone for you help.
Until the next time 😉
Jake
Can u plz explain what do u mean by "against each month" and what exactly u need to get by using quick measure. I can give it a try.