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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
bvermeer
Regular Visitor

Calculated Measure won't Filter in Table

First time post bear with me...

 

I have created a MTD function to view sales data for my company:

 

MTD = CALCULATE([Total Sales], FILTER(ALL('Date'[Date]),
          'Date'[Date] >= (EOMONTH(NOW(), -1) + 1) &&
          'Date'[Date] <= NOW()
))

 

This function is working fine, BUT when I load it into a table in order to report on this data I'm running into an issue. I need to break down all the sales in the given month by date for the whole month. Using a table and making the column my 'Date'[Date] function I thought this would break this MTD function down by date. Instead I get the following:

 

Capture.PNG

 

The 'MTD' measure is the one I just created and it's not getting filtered. The 'Total Sales' measure is the one referenced in the MTD measure and it's filtering fine. 

 

I am stuck and can't figure out what I'm missing. Any advice would be greatly appreciated. 

1 ACCEPTED SOLUTION
KHorseman
Community Champion
Community Champion

It's because of the ALL() in your filter. You're telling it to always ignore any other date filters. That includes any filter that breaks it down to a single day.

 

MTD = CALCULATE(
	[Total Sales],
	FILTER(
		'Date',
		'Date'[Date] >= (EOMONTH(TODAY(), -1) + 1) &&
		'Date'[Date] <= TODAY()
	)
)

Also you should use TODAY() instead of NOW() when comparing to a date-only value, which your 'Date'[Date] should be. NOW() returns a datetime, which will never be equal to any date value, so <= only evaluates on <.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
KHorseman
Community Champion
Community Champion

It's because of the ALL() in your filter. You're telling it to always ignore any other date filters. That includes any filter that breaks it down to a single day.

 

MTD = CALCULATE(
	[Total Sales],
	FILTER(
		'Date',
		'Date'[Date] >= (EOMONTH(TODAY(), -1) + 1) &&
		'Date'[Date] <= TODAY()
	)
)

Also you should use TODAY() instead of NOW() when comparing to a date-only value, which your 'Date'[Date] should be. NOW() returns a datetime, which will never be equal to any date value, so <= only evaluates on <.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thank you very much!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.