Forum Discussion
Saxon10
Post Prodigy
5 years agoCalculate MAX date based on the multiple columns
Data: I have a two tables are data and report In data table contain item, country, date, time, area code and sales code Country column contains INDIA, PAK, US, UK, AUS, SRI, CAND, NEWL...
- 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.
Saxon10
Post Prodigy
5 years agoI would like to achieve my desired result by using New Calculated column option. Can you please advise.