Forum Discussion
DAX max value by category
Hello, I have this measure to calculate the maximum number of passengers per train and per date. I would like to keep only one line per train, which keeps only the line of the date with the highest value for each train. I can do it by filtering on my rank column but we would like to succeed in DAX.
thanks !!
Hi Anonymous ,
Try the following formula:
Measure = var Maxium = MAXX( ALL('Tab_FQ_Emport Max Train Jour'[date]), CALCULATE(SUM('Tab_FQ_Emport Max Train Jour'[Emport_Max_Train_Jour])) ) return IF( SUM('Tab_FQ_Emport Max Train Jour'[Emport_Max_Train_Jour]) = Maxium, Maxium )If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
WinnizIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 Replies
- lbendlinSuper User
That means that you only want to display the train column, and then you need separate measures for the date of max occupancy for each train, and then occupancy number for that train and date.
- v-kkf-msftCommunity Support
Hi Anonymous ,
Try the following formula:
Measure = var Maxium = MAXX( ALL('Tab_FQ_Emport Max Train Jour'[date]), CALCULATE(SUM('Tab_FQ_Emport Max Train Jour'[Emport_Max_Train_Jour])) ) return IF( SUM('Tab_FQ_Emport Max Train Jour'[Emport_Max_Train_Jour]) = Maxium, Maxium )If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
WinnizIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Ashish_MathurSuper User
Hi,
Share some data (in a format that can be pasted in MS Excel) and show the expected result.