Forum Discussion
Calculate MAX date based on the multiple columns
- 5 years ago
Hi, Saxon10
Please kindly check the below which is for the Calculated Column.
I am not quite sure if the below is the most optimized way to write, but I tried to come up with the solution.
Max Date new column =VAR countriescondition =INTERSECT (SUMMARIZE ( FILTER ( Data, Data[ITEM] = Report[ITEM] && DATA[SALES CODE] = REPORT[SALES CODE] ), Data[COUNTRY] ),{ "INDIA", "US", "UK", "NEWL" })VAR countriescondition2 =INTERSECT (SUMMARIZE ( FILTER ( Data, Data[ITEM] = Report[ITEM] && DATA[SALES CODE] = REPORT[SALES CODE] ), Data[COUNTRY] ),{ "XXX" })VAR newtable =FILTER (Data,Data[ITEM] = Report[ITEM] && DATA[SALES CODE] = REPORT[SALES CODE]&& DATA[COUNTRY]IN { "INDIA", "US", "UK", "NEWL" }&& Data[AREA CODE] = "A")VAR newtable2 =FILTER (Data,Data[ITEM] = Report[ITEM] && DATA[SALES CODE] = REPORT[SALES CODE]&& DATA[COUNTRY] = "XXX"&& Data[AREA CODE] = "B")RETURNIF (COUNTROWS ( countriescondition ) = 4,MAXX ( newtable, Data[DATE] ),IF (COUNTROWS ( countriescondition2 ) = 1&& COUNTROWS (SUMMARIZE ( FILTER ( Data, Data[ITEM] = Report[ITEM] && DATA[SALES CODE] = REPORT[SALES CODE] ), Data[COUNTRY] )) = 1,MAXX ( newtable2, DATA[DATE] ),BLANK ()))Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
Hi, Saxon10
Please kindly check the below which is for the Calculated Column.
I am not quite sure if the below is the most optimized way to write, but I tried to come up with the solution.
Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
Hi,
Thanks for your reply and help. It's working perfectly without any problems.