Forum Discussion
help with max value
- Anonymous5 years ago
Hi davidibi4524 ,
I created a sample pbix file(see attachment) for you, please check whether that is what you want. I used the following methods separately to get the latest order date:
1. Create a table visual with Max of Order date
2. Create a measure to get the latest order date
Latest order date = CALCULATE ( MAX ( 'Prev_forecast'[Order date] ), FILTER ( 'Prev_forecast', 'Prev_forecast'[CUSTNAME] = SELECTEDVALUE ( Prev_forecast[CUSTNAME] ) && 'Prev_forecast'[ordname] = SELECTEDVALUE ( 'Prev_forecast'[ordname] ) ) )3. Create a calculated table
TableName = SUMMARIZE ( 'Prev_forecast', 'Prev_forecast'[CUSTNAME], 'Prev_forecast'[ordname], "maxordate", CALCULATE ( MAX ( 'Prev_forecast'[Order date] ) ) )Best Regards
In case of DAX table:
TableName =
ADDCOLUMNS (
DISTINCT ( 'T'[Customer] ),
"@latestDate", CALCULATE ( MAX ( 'T'[OrderDate] ) )
)DAX query:
EVALUATE
ADDCOLUMNS (
DISTINCT ( 'T'[Customer] ),
"@latestDate", CALCULATE ( MAX ( 'T'[OrderDate] ) )
)
If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.
its looks like close to the solution,because now i need to add some more columns and its didnt work for me. i can only add the first column again (custname)
here is a screenshot:
- ERD5 years agoCommunity Champion
davidibi4524 , you need to add an existing column or to calculate something?
If you need to add several columns like 'T'[Customer], then the code will be a bit different:
TableName = ADDCOLUMNS ( SUMMARIZE('T', 'T'[Customer], 'T-main'[AnotherColumn]), "@latestDate", CALCULATE ( MAX ( 'T'[OrderDate] ) ) )If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.