Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi all I have a table with 2 types of capacity in it and for every record a startdate and enddate. Some dummy data is here:
As you can see there is capacity for a costcenter or capacity for a group. A group is a lower level than a costcenter. This all is based on a very simple starschema.
Now I'm creating measures to show the correct amount of capacity for groups and costcenters. My measures are defined as follows:
CC Capacity =
VAR CurDate = SELECTEDVALUE('Date'[Date])
VAR x = SUMX('Date', MAXX(FILTER(Capacity, NOT(ISBLANK(Capacity[CapacityCC])) && CurDate < Capacity[Enddate] && CurDate >= Capacity[Startdate]), SUM(Capacity[CapacityCC])))
RETURN xand
Group Capacity =
VAR CurDate = SELECTEDVALUE('Date'[Date])
VAR x = SUMX('Date', MAXX(FILTER(Capacity, NOT(ISBLANK(Capacity[CapacityGroup])) && CurDate < Capacity[Enddate] && CurDate >= Capacity[Startdate]), SUM(Capacity[CapacityGroup])))
RETURN x
But what's wrong here is the output 🤣
I have some examples.
Problem 1
Example 1 is selecting 1 specific data (i.e. 2 february 2021) which is giving me the incorrect amount because it's summing all the records that apply, not only the one that should be active based on there start- and enddate.
38 is the result of 18 + 20 while it should be only 18. And 62 is the sum of 30 and 32 instead of just 30.
Problem 2
Problem 2 is when you don't select 1 specific date but a month it's not showing anything. While I should expect the last empty value for that specific month/group/cc.
Is there a dax-guru here to help me out?
File with my example data and all relevant dimensions can be found here.
Solved! Go to Solution.
You can use
CC Capacity copy =
VAR CurDate = MAX( 'Date'[Date] )
VAR x =
CALCULATE(
SUM( 'Capacity'[CapacityCC] ),
NOT ISBLANK( 'Capacity'[CapacityCC] )
&& CurDate < 'Capacity'[Enddate]
&& CurDate >= 'Capacity'[Startdate]
)
RETURN
x
Group Capacity copy =
VAR CurDate = MAX( 'Date'[Date] )
VAR x =
CALCULATE(
SUM( 'Capacity'[CapacityGroup] ),
NOT ISBLANK( 'Capacity'[CapacityGroup] )
&& CurDate < 'Capacity'[Enddate]
&& CurDate >= 'Capacity'[Startdate]
)
RETURN
x
And if I have an additional wish; I also want to see the numbers for a month where a record stops as well? So by example the line with enddate 25-12-2023 must be visible in december 2023 as well. I've tried some things but for the situation where a new line follows up with start 26-12-2023 I go double...
You can use
CC Capacity copy =
VAR CurDate = MAX( 'Date'[Date] )
VAR x =
CALCULATE(
SUM( 'Capacity'[CapacityCC] ),
NOT ISBLANK( 'Capacity'[CapacityCC] )
&& CurDate < 'Capacity'[Enddate]
&& CurDate >= 'Capacity'[Startdate]
)
RETURN
x
Group Capacity copy =
VAR CurDate = MAX( 'Date'[Date] )
VAR x =
CALCULATE(
SUM( 'Capacity'[CapacityGroup] ),
NOT ISBLANK( 'Capacity'[CapacityGroup] )
&& CurDate < 'Capacity'[Enddate]
&& CurDate >= 'Capacity'[Startdate]
)
RETURN
x
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 19 | |
| 11 | |
| 9 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 35 | |
| 32 | |
| 20 | |
| 12 | |
| 10 |