Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not 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)

6 REPLIES 6
Anonymous
Not applicable

@Greg_Deckler , 
As I understand this formula, it starts summing up values on 1 April and restarts every year on the same date.
The first value is of 1 April, the second value is of 2 April + 3 April, the third value is of 3 April +4 April+5 April and so on.

vkng_1-1677621424883.png

 

@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
  __Result


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler The formula works as a cumulative total. There window element is not there. 

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



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable
Greg_Deckler
Community Champion
Community Champion

@Anonymous What does WINDOW_SUM do?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.