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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
jbobeck
Frequent Visitor

Filter not working with measure results

I have a report that is displaying a metric in two different time periods.  The base metric is just a COUNT and is connected to Between date slicer which is working perfectly.  I also need to display the same metric as a year to date count with the ending date equal to the second date in the slicer.  I've created a measure to pull the date selected using:

EndDate = LASTDATE('DimDate'[Date])

When I try creating a new measure to create the YTD I can't seem to get the proper functionality.  I've tried the following but Filter does not seem to work when passed the EndDate measure:

Measure= CALCULATE(
        COUNT('Table'[TableKey])
        , FILTER('DimDate', [Date] <= [EndDate]))

If I remove EndDate and hard code a date value it works.  Is there something I am missing?

1 ACCEPTED SOLUTION

Was able to get the measure to work, had to keep the visualization connected to the slicer and do the following;

MeasureYTD = 
VAR MaxDate = [EndDate]
RETURN
CALCULATE([BaseMeasure], ALL('FactTable'), 'DimDate'[YearToDateFlag] = TRUE, 'DimDate'[Date] <= MaxDate)

View solution in original post

3 REPLIES 3
HotChilli
Super User
Super User

I think using MAX instead of LASTDATE is what you need

Unfortunately using MAX doesn't change the reults, though it still does return the correct date value that matches LASTDATE.

Was able to get the measure to work, had to keep the visualization connected to the slicer and do the following;

MeasureYTD = 
VAR MaxDate = [EndDate]
RETURN
CALCULATE([BaseMeasure], ALL('FactTable'), 'DimDate'[YearToDateFlag] = TRUE, 'DimDate'[Date] <= MaxDate)

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.