Forum Discussion
Find a value associated with the latest date
- 7 years ago
Hi,
This measure works
Measure = CALCULATE(SUM('Sheet 1'[METER]),LASTDATE('Sheet 1'[METER_DATE]))Hope this helps.
I get this error when using your formula in a measure:
A function 'MAX' has been used in a True/False expression that is used as a table filter expression. This is not allowed.
Hey cmccully
I saw your response last night when I got home from work. My apologies.
I should have formatted the filter argument of Calculate differently:
Latest Date Max_Min =
CALCULATE(
MAX(Query1[Meter]) - MIN(Query1[Meter]),
FILTER(
Query1,
Query1[Meter_Date] = MAX(Query1[Meter_Date])
)
)Here is a screenshot of my test:
Click HERE to access my pbix file used for testing.
- cmccully7 years ago
Helper I
Sorry for taking so long to respond. I created a measure using your new DAX code but am still not getting anything. I posted a link below to the PBIX test file I am using.
Here is what it looks like when I try to use the measure:
I want to get the mileage 106878 as that is the reading associated with the latest date.
Thank you!
https://drive.google.com/file/d/14Vq9JOr5tWuilC4Z-rbM6BSnulIzJ8LU/view?usp=sharing
- Ashish_Mathur7 years ago
Super User
Hi,
This measure works
Measure = CALCULATE(SUM('Sheet 1'[METER]),LASTDATE('Sheet 1'[METER_DATE]))Hope this helps.
- cmccully7 years ago
Helper I
Thank you, that worked!