Forum Discussion
Building Waterfall Chart Stores Open and Close
Hello community!
I'm trying to build a Waterfall Chart in Power BI to show the monthly evolution of a network of units (e.g., branches or locations), considering:
In → Units opened during the month
Out → Units closed during the month
- Total → Total active units at the end of the month.
My Base Table
I have a table called 'UnitsTable' with the following fields:
| UnitID | OpeningDate | ClosingDate |
| Text | Date | Date (can be blank) |
Here´s an example of the data:
UnitID OpeningDate ClosingDate
| 001 | 2023-01-10 | |
| 002 | 2023-02-15 | 2023-05-20 |
| 003 | 2023-03-05 | |
| 004 | 2023-03-28 | 2023-04-30 |
| 005 | 2023-04-01 | |
| 006 | 2023-05-10 | |
| 007 | 2023-05-12 | 2023-06-15 |
What I Want to Build
I’d like to generate a Waterfall Chart with three bars per month:
In → Units opened
Out → Units closed
Total → Cumulative total of active units
The previous image is an example of how I want my chart to look — it was created in Excel, but I want to achieve the same output in Power BI.
What I Tried
I tried creating a measure-based approach, but the result was disorganized and hard to control within a visual. So I decided to build a calculated table to better structure the values by category and date.
Waterfall_InOut =
VAR UniqueDates =
DISTINCT (
UNION (
SELECTCOLUMNS(
FILTER('UnitsTable', NOT ISBLANK('UnitsTable'[OpeningDate])),
"Date", DATE(YEAR('UnitsTable'[OpeningDate]), MONTH('UnitsTable'[OpeningDate]), 1)
),
SELECTCOLUMNS(
FILTER('UnitsTable', NOT ISBLANK('UnitsTable'[ClosingDate])),
"Date", DATE(YEAR('UnitsTable'[ClosingDate]), MONTH('UnitsTable'[ClosingDate]), 1)
)
)
)
-- Entries
VAR Entries =
ADDCOLUMNS (
UniqueDates,
"Category", "In",
"Value",
VAR CurrentDate = [Date]
RETURN
CALCULATE (
COUNTROWS('UnitsTable'),
FILTER (
'UnitsTable',
NOT ISBLANK('UnitsTable'[OpeningDate]) &&
EOMONTH('UnitsTable'[OpeningDate], 0) = EOMONTH(CurrentDate, 0)
)
)
)
-- Exits
VAR Exits =
ADDCOLUMNS (
UniqueDates,
"Category", "Out",
"Value",
VAR CurrentDate = [Date]
RETURN
-CALCULATE (
COUNTROWS('UnitsTable'),
FILTER (
'UnitsTable',
NOT ISBLANK('UnitsTable'[ClosingDate]) &&
EOMONTH('UnitsTable'[ClosingDate], 0) = EOMONTH(CurrentDate, 0)
)
)
)
-- Totals
VAR Totals =
ADDCOLUMNS (
UniqueDates,
"Category", "Total",
"Value",
VAR CurrentDate = [Date]
RETURN
CALCULATE (
COUNTROWS('UnitsTable'),
'UnitsTable'[OpeningDate] <= EOMONTH(CurrentDate, 0),
OR (
ISBLANK('UnitsTable'[ClosingDate]),
'UnitsTable'[ClosingDate] > EOMONTH(CurrentDate, 0)
)
)
)
-- Combine all data
RETURN
UNION (
SELECTCOLUMNS(Entries, "Date", [Date], "Category", [Category], "Value", [Value]),
SELECTCOLUMNS(Exits, "Date", [Date], "Category", [Category], "Value", [Value]),
SELECTCOLUMNS(Totals, "Date", [Date], "Category", [Category], "Value", [Value])
)
Example Result:
Date Category Value
| 2023-01-01 | In | 1 |
| 2023-01-01 | Out | 0 |
| 2023-01-01 | Total | 1 |
| 2023-02-01 | In | 1 |
| 2023-02-01 | Out | 0 |
| 2023-02-01 | Total | 2 |
| 2023-03-01 | In | 2 |
| 2023-03-01 | Out | 0 |
| 2023-03-01 | Total | 4 |
| 2023-04-01 | In | 1 |
| 2023-04-01 | Out | -1 |
| 2023-04-01 | Total | 4 |
| 2023-05-01 | In | 2 |
| 2023-05-01 | Out | -1 |
| 2023-05-01 | Total | 5 |
| 2023-06-01 | In | 0 |
| 2023-06-01 | Out | -1 |
| 2023-06-01 | Total | 4 |
My Visual Result:
Let me know if there’s a better way to build the cumulative calculation or if there's a more elegant way to display this in a Waterfall Chart.
Thanks in advance!
Hi Joaomatos2002 ,
Thank you for reaching out to Microsoft Fabric Community Forum.This is a well-structured and effective solution. The approach of creating a calculated table to categorize "In", "Out", and "Total" values per month works very well for a Waterfall Chart. It ensures clarity, accurate cumulative calculations, and avoids the complexity of using multiple measures.
The logic covers all key aspects—unit openings, closures, and the evolving total of active units—making it both robust and visually intuitive. No changes are needed at this stage, as the current method is both scalable and reliable for your reporting
Regards,
Chaithanya.
4 Replies
- v-kathullac
Community Support
Hi Joaomatos2002 ,
Thank you for reaching out to Microsoft Fabric Community Forum.This is a well-structured and effective solution. The approach of creating a calculated table to categorize "In", "Out", and "Total" values per month works very well for a Waterfall Chart. It ensures clarity, accurate cumulative calculations, and avoids the complexity of using multiple measures.
The logic covers all key aspects—unit openings, closures, and the evolving total of active units—making it both robust and visually intuitive. No changes are needed at this stage, as the current method is both scalable and reliable for your reporting
Regards,
Chaithanya.
- v-kathullac
Community Support
Hi Joaomatos2002 ,
we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.
Regards,Chaithanya
- v-kathullac
Community Support
Hi @Joaomatos2002 ,
we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.
Regards,Chaithanya
- v-kathullac
Community Support
Hi @Joaomatos2002 ,
we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.
Regards,Chaithanya