Forum Discussion
Measure is not returning any value but working when explicit value is being used
Hi julsr - you need to create a measure or calculated column that dynamically determines the date. Then, you can use this dynamic date as a filter context for other calculations.
create a ameasure
SelectedDate =
VAR MaxDate = MAX('DateTable'[Date]) // Adjust this to match your logic
RETURN
IF(
MaxDate = TODAY() - 1, // Replace with your D-1 logic
MaxDate,
BLANK()
)
Once you have the measure, you can use it as part of your filter logic in other measures.
FilteredMeasure =
CALCULATE(
SUM('FactTable'[Value]),
FILTER(
'DateTable',
'DateTable'[Date] = [SelectedDate]
)
)
If your SelectedDate measure is returning a scalar value (like a specific date), you can directly apply it as a filter condition in your visualizations.
Thanks for your answer. That's exactly what I've done in my PBIX which I attached in the thread. The problem is that the formula is not returning a value that I can use in another measure. For example, what I want/need is to return the DayMinus1 or SelectedDate (the value itself) and then use this result in another measure as a filter, but it's not working and I don't know what's wrong.