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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

DAX formula for value at point in time (dynamic)

This might not be as diffifult as I think, but I am having trouble to get around it.

I have a table that consist of cases: one row per case. Each case has a start date and an end date. I have added a quantity column  for clarity so that I can use SUM instead of COUNT.

What I need to do is to calculate ONGOING cases at the end of the chosen month. i.e where start date is on or before the last day in the chosen month, and with an end date that is AFTER the last day in the chosen month.

It was easy enough to create a test measure for a specific month, but I am not able to make it dynamic to work with year and month filter/slicer.

Any suggestions?

Here's my test measure:

TEST_OngoingCases_dec2018:=

CALCULATE(SUM(FactCase[Quantity]);FactCase[RegDate_FK]<=20181231;FactCase[ClosingDate_FK]>20181231)

 

3 REPLIES 3
Gokul
Helper IV
Helper IV

can u please post some sample data and expected results

Anonymous
Not applicable

cases.JPGdate.JPG

 

Se pictures for sample data. I have loaded these tables into my Power BI (only two of several as part of my model). Datetable is loaded twice, once as RegDate and once as ClosingDate.

 

What I want to do is to be able to use the year and month from one of the date tables to filter 'Ongoing cases' measure. If i choose Jan 2018 I want to see the sum of all cases with a regdate on or before 31st of jan AND with a closing date after 31st jan. Same for feb, march, april etc.

hi, @Anonymous

You may try this measure 

 

Measure = CALCULATE(COUNTA(Table1[ID]),FILTER(Table1,Table1[RegDate ]<=MAX('Date'[Date])&&Table1[ClosingDate]>MAX('Date'[Date])))

Note: Do not create the relationship between data table with date table

this is based on the year and month you just select one value.

If you select two or more the year and month, what is the logic ?

For example:

If you choose Jan 2018 and Feb 2018 .

 

Best Regards,

Lin

 

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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