0
votes

I am very new to power bi DAX and I don't figure out why my measure is not working properly. So I have created one measure to for date and applied that to visual level filter to default data to always show the last x months or all data where applicable. So far it is giving me the date range between min and max but visuals are not updating according to default date range. When I change date range then my visuals are get updated. I want my visual with latest default date and data. Please let me know how can I accomplish this. Note: I applied this measure on slicer which showing date range.

Here is the measure that I have applied:

Min_Max_ad_srch = VAR LatestDate = CALCULATE(MAX(ADS[DATE]), ALL(ADS)) RETURN IF(MIN(ADS[DATE]) = LatestDate, 1, 0)
1

1 Answers

1
votes

If I understand correctly, you want to display a fixed set of data in a visual, and to have it not change when other selections are made.

You would best accomplish this not through filtering the visual but by applying the filtering condition to the measure that the visual is displaying.

So, you would use something like:

My Measure (for Latest Date) = 
VAR LatestDate = CALCULATE(MAX(ADS[DATE]), ALL(ADS)) RETURN
CALCULATE([a Measure], ALL(ADS[DATE]), ADS[Date] = LastestDate)

using ALL(ADS[DATE]) effectively ignores any selection made in ADS[DATE], and subsequently saying ADS[DATE] = LatestDate applies the date filter you're asking for.

With this formula in your visual, you will always show data for the latest date, regardless what other date selections are made.