Forum Discussion
Anonymous
3 years agoNot applicable
Convert Tableau function WINDOW_SUM into DAX
Hello, I would like to convert the below Tableau expression into DAX: WINDOW_SUM(sum([values]), -DATEDIFF('day',DATE('1/4/'+str(year(DATEADD('month',-3,attr([Date]))))),attr([Date])),0)
Greg_Deckler
3 years agoCommunity Champion
Anonymous Maybe:
Cumulative April 1 =
VAR __Date = MAX('Table'[Date])
VAR __Year = IF(MONTH(__Date) < 4, YEAR(__Date) - 1 , YEAR(__Date))
VAR __Table = FILTER(ALL('Table'), [Date] <= __Date && [Date] >= DATE(__Year, 4, 1))
VAR __Result = SUMX(__Table, [Values])
RETURN
__ResultAnonymous
3 years agoNot applicable
Greg_Deckler The formula works as a cumulative total. There window element is not there.
- Greg_Deckler3 years agoCommunity Champion
Anonymous Right, the formula I provided is a cumulative total that resets on April 1st. There is a new WINDOW function in DAX. It's sort of kind of supposed to work at a "visual" level but that's not really how it works.
If you want a cumulative total that resets on April 1st, the formula I provided should work. It dynamically creates the "window" in the __Table VAR.