Forum Discussion
Latest Date Filter
- 7 years ago
Hi Nicole,
There could be three solutions. Please check out you Messages box and download the demo.
1. If every property has all the same dates, you can filter them directly. Please refer to the snapshot below.
2. Add a column in the Query Editor and filter.
if [Area Date] = List.Max(let currentProperty = [Property Code] in Table.SelectRows(#"Changed Type", each [Property Code] = currentProperty)[Area Date]) then 1 else 03. Use DAX formula.
Table = FILTER ( ADDCOLUMNS ( 'Table3', "IfMax", CALCULATE ( MAX ( Table3[Area Date] ), FILTER ( 'Table3', 'Table3'[Property Code] = EARLIER ( Table3[Property Code] ) ) ) ), [IfMax] = [Area Date] )Best Regards,
Dale
Hi Nicole,
There could be three solutions. Please check out you Messages box and download the demo.
1. If every property has all the same dates, you can filter them directly. Please refer to the snapshot below.
2. Add a column in the Query Editor and filter.
if [Area Date] = List.Max(let currentProperty = [Property Code]
in Table.SelectRows(#"Changed Type",
each [Property Code] = currentProperty)[Area Date])
then 1
else 0
3. Use DAX formula.
Table =
FILTER (
ADDCOLUMNS (
'Table3',
"IfMax", CALCULATE (
MAX ( Table3[Area Date] ),
FILTER ( 'Table3', 'Table3'[Property Code] = EARLIER ( Table3[Property Code] ) )
)
),
[IfMax] = [Area Date]
)
Best Regards,
Dale
Thank you so much v-jiascu-msft, the second solution works great!
You have saved me so much time with this! 🙂
I have a question about the third solution, which I would really like to use for another context:
I get the error:
"DAX comparison operations do not support comparing values of type Date with values of type Text."
which i believe is what is being done by the MAX function in my case. (I'm not having a property code, but a System ID, which is in text-format.) Even if you have a numerical value, it feels wrong to do MAX of the DATE and the Property Code/System ID.
Or am I misunderstanding something? If you could fix the DAX, I would be very interested in what that would look like, since I'm trying to get the hang of EARLIER and such expressions.