Forum Discussion
MAX date
- Anonymous2 years ago
Hi JolienR ,
Please try:LastOrderDate = VAR __table = CALCULATETABLE ( ADDCOLUMNS ( SUMMARIZE ( 'Table', 'Table'[CustomerID], 'Table'[ColumnName1], //2021 'Table'[ColumnName2] //kwartaal2&kwartaal3 ), "date", [OrderDates12-6Months] ), ALLSELECTED ( 'Table'[ColumnName2] ) ) VAR _lastdate = MAXX ( __table, [date] ) RETURN _lastdateOutput:
Best Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Try the following:
CALCULATE(MAX('YourTable'[OrderDate]), FILTER('YourTable',
'YourTable'[CustomerID] = SELECTEDVALUE('YourTable'[CustomerID])
&& 'YourTable'[OrderDate] <= MAX('YourTable'[MainDateField]))
)
This effectively removes the filter context at row level and reapplies only some of it, in this case: CustomerID to ensure the value is specific per customerid; and OrderDate <= the largest date in your date table, so that it falls within your date slicer parameters. Hope this helps, let me know if you have any issues/questions.