Forum Discussion
"Hacking" a waterfall chart
Hi ItoDiaz
I've managed to get something to work, but this is a "proper" hack using stacked bar charts and made possible using the new recently released window functions as offfered by microsoft.
I've written a blog post on how to do it:
https://www.iheartdemography.com/post/hacking-a-waterfall-chart-in-powerbi
Essentially you use the window functions to work out some cumulative totals and then from there calculate the whitespace needed for some blocks of absolute value
Using these measures:
Waterfall Cumulative = calculate([Sum of Amount], WINDOW(1,ABS,0,REL, SUMMARIZE(ALLSELECTED(Sheet1),Sheet1[Date]), ORDERBY(Sheet1[Date]) ))
Waterfall Cumulative -1 = calculate([Sum of Amount], WINDOW(1,ABS,-1,REL, SUMMARIZE(ALLSELECTED(Sheet1),Sheet1[Date]), ORDERBY(Sheet1[Date]) ))
Waterfall White Space = min([Waterfall Cumulative -1],[Waterfall Cumulative])
Waterfall Block -ve = If(AND([Sum of Amount]<0,DATEDIFF(DATE(2023,5,6), Max(Sheet1[Date]) ,DAY)<>0),Abs([Sum of Amount]))
Waterfall Block +ve = if([Sum of Amount]>0 ,[Sum of Amount])
Waterfall Block Special = If(DATEDIFF(DATE(2023,5,6), Max(Sheet1[Date]) ,DAY)=0,Abs([Sum of Amount]))
The blocks and whitespace can be loaded into a stacked bar chart which can "look like " a waterfall and offers more flexibility
Does this help as a starter?
Pi