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
bo_afk
Post Patron
Post Patron

Measure with calculate before date not working

I've created a measure to calculate another measure only for dates before a particular date.

i.e. CALCULATE( [measure] , [date] < 01/09/2019)

But my result is coming up as blank. Can someone tell me what is wrong with this formula? Reason for this formula is that I want to create a measure for before and after this date and then calculate the difference between these.

1 ACCEPTED SOLUTION
v-eachen-msft
Community Support
Community Support

Hi @bo_afk ,

 

CALCULATE needs two kinds of parameter: Expression and Filter. So you need a table range to get a filter.

So you could try the following DAX:

Measure =
CALCULATE ( [measure], FILTER ( 'Table', [date] < DATE ( 2019, 1, 9 ) ) )

 

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

View solution in original post

6 REPLIES 6
v-eachen-msft
Community Support
Community Support

Hi @bo_afk ,

 

CALCULATE needs two kinds of parameter: Expression and Filter. So you need a table range to get a filter.

So you could try the following DAX:

Measure =
CALCULATE ( [measure], FILTER ( 'Table', [date] < DATE ( 2019, 1, 9 ) ) )

 

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

Thanks @v-eachen-msft. This looks to have done the trick!

Anonymous
Not applicable

Hi @bo_afk ,

 

I'm not totally sure because dates are always something tricky 😁.

 

Try to format it inside DATE function I think that would pass it with no problems.

 

Let me know if it helped.

 

BR,

DR

Thanks for your suggestion @Anonymous 

I did try using the date function but it didn't seem to work. I suspect that's because it outputs a datetime format and my data has only date. I think tried to format it as "dd/mm/yyyy" but then got an error that I can't compare date values with text.

 

Update: so the date function works when I use a simple sum as my calculation, but when I input my measure, it doesn't work. Must be an issue with my measure then.

Anonymous
Not applicable

Most likely, I would need some sample data to make a few tests but that usually work.

In general, does the calculate formula work with measures and dates?

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.