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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
ryan_b_fiting
Post Patron
Post Patron

Measure to calculate a value up until an end date

Hello Community - 

I am in need of some help calculating a Capacity number for my providers.  Below is a sample set of capcity dimensional table (it is modeled joining to a visit table which is my fact table).  What I am looking to do is calculate the capacity for each provider, but when their capacity changes on a specific date, the capacity amount calculates properly.

ProviderIDCapacityPracticeStart Date
23095Chiro1/1/2023
23195Chiro1/1/2023
23295Chiro1/1/2023
25550Acu1/1/2023
31025.5FM1/1/2023
31150Acu1/1/2023
35328FM1/1/2023
36255Acu1/1/2023
37128FM1/1/2023
38595Chiro1/1/2023
39165Acu1/1/2023
40995Chiro1/1/2023
41095Chiro1/1/2023
42017FM1/1/2023
42010FM8/1/2023

 

So what I would like show based on the sample data above for ProviderID 420, Capacity would be 17 per month for 2023 up until 8/1/2023, once the date hits 8/1/2023 the capacity would fall to 10.  So the total capacity YTD to Provider 420 would be 139 (17*7 (Jan-Jul) + 10*2 (Aug-Sep)).

 

How can I caculate this to be dynamic so as the capacity of providers change, the numbers in my PBI report will reflect the correct calcs?

 

Thank you in advance for your help!

Ryan F.

2 REPLIES 2
mh2587
Super User
Super User

Measure1
Dynamic Capacity =
VAR CurrentDate = MAX('Date Table'[Date])
RETURN
CALCULATE(
SUM('Capacity Dimensional Table'[Capacity]),
FILTER(
'Capacity Dimensional Table',
'Capacity Dimensional Table'[ProviderID] = SELECTEDVALUE('Capacity Dimensional Table'[ProviderID]) &&
'Capacity Dimensional Table'[Start Date] <= CurrentDate
)
)
Measure2
YTD Capacity =
VAR CurrentMonth = MAX('Date Table'[Date])
RETURN
SUMX(
FILTER(
ALL('Date Table'),
'Date Table'[Date] <= CurrentMonth
),
[Dynamic Capacity]
)





Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



@mh2587 thanks for the help.  This is very close.  However, when I am looking at it by month for provider 420, once I hit August, the capacity is not 10, but it is 27 (adding up the the 2 separate capacity values).  I have tried to tweak it a few different ways, but have not had luck.  I would expect to see 17 from January 2023 through July, but then August forward I would expect to see 10, not 27.  Any ideas on the small tweak needed here?

Helpful resources

Announcements
Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.