Forum Discussion
Power Bi latest Date column
- 10 months ago
Sorry Hardy2617, I really need new glasses. I missed the part that you have multiple columns to compare 🫣
Do you need the highest date out of the three columns overall or the highest per row?Highest date between the three columns for each row:
Highest Date per Row = VAR DatesTable = FILTER( { ( [DateID] ), ( [Date2] ), ( [Date3] ) }, [Value] <> BLANK() ) RETURN MAXX ( DatesTable, [Value] )-----------------------
Highest date overall accross all rows:
Highest Date All Columns overall = VAR AllDates = UNION( SELECTCOLUMNS( 'FactTable', "date", 'FactTable'[DateID] ), SELECTCOLUMNS( 'FactTable', "date", 'FactTable'[Date2] ), SELECTCOLUMNS( 'FactTable', "date", 'FactTable'[Date3] ) ) RETURN MAXX( FILTER(AllDates, NOT ISBLANK([date])), [date] ) - 10 months ago
Hi Hardy2617
Try the following:
Max acrross rows (calc column) = MAXX ( { data[Start Date], data[End Date], data[Order Date], data[Delivery Date], data[Payment Date] }, [Value] )MEASURES: Max date across columns & rows = CALCULATE ( MAXX ( { MAX ( data[Delivery Date] ), MAX ( data[End Date] ), MAX ( data[Payment Date] ), MAX ( data[Start Date] ) }, [Value] ), REMOVEFILTERS ( data ) ) Max date across rows = MAXX ( { MAX ( data[Delivery Date] ), MAX ( data[End Date] ), MAX ( data[Payment Date] ), MAX ( data[Start Date] ) }, [Value] )
Hi Hardy2617 if you want to add it as a calculated column you can use MAX() to add your highest date as a static value in a separate column:
Thank fro your Reply KarinSzilagyi , But I have multiple dates columns its for tracking a shipment and it has multiple dates for multiple location that shipment goes through. how to do it then? I tried using MAXX(), but its still getting worng dates or ealiest date for some rows.
- KarinSzilagyi10 months ago
Super User
Sorry Hardy2617, I really need new glasses. I missed the part that you have multiple columns to compare 🫣
Do you need the highest date out of the three columns overall or the highest per row?Highest date between the three columns for each row:
Highest Date per Row = VAR DatesTable = FILTER( { ( [DateID] ), ( [Date2] ), ( [Date3] ) }, [Value] <> BLANK() ) RETURN MAXX ( DatesTable, [Value] )-----------------------
Highest date overall accross all rows:
Highest Date All Columns overall = VAR AllDates = UNION( SELECTCOLUMNS( 'FactTable', "date", 'FactTable'[DateID] ), SELECTCOLUMNS( 'FactTable', "date", 'FactTable'[Date2] ), SELECTCOLUMNS( 'FactTable', "date", 'FactTable'[Date3] ) ) RETURN MAXX( FILTER(AllDates, NOT ISBLANK([date])), [date] )- Anonymous9 months agoNot applicable
Hi Hardy2617 ,
Thank you KarinSzilagyi for the response provided!
Has your issue been resolved? If the response provided by the community member addressed your query, could you please confirm? It helps us ensure that the solutions provided are effective and beneficial for everyone.
Thank you for your understanding!- Anonymous9 months agoNot applicable
Hi Hardy2617 ,
I wanted to follow up and see if you had a chance to review the information shared. If you have any further questions or need additional assistance, feel free to reach out.
Thank you.