The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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?
Solved! Go to 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)
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)
User | Count |
---|---|
16 | |
8 | |
6 | |
6 | |
5 |
User | Count |
---|---|
23 | |
13 | |
13 | |
8 | |
8 |