Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi everyone,
I have this table and I have to create a table view in Power BI Desktop that displays one single row for each customer, with the max of the last event date (I've yet created a measure for this), and the type of event at this last date by customer, if there are two equal last date elements it has to return the type with the higher type code.
I started with a DAX of this structure CALCULATE( VALUES, FILTER).
If I write two filters, their combination result the type only when at the last event date it has is maximum type code. It's like I need the second filter activated only when there are two equals lasta date.
Is anyone able to solve this?
Solved! Go to Solution.
Hi @AGo,
You can refer to below steps to achieve your requirement:
Source table:
Table formula:
Result Table = ADDCOLUMNS(ADDCOLUMNS(SUMMARIZE(Records,Records[Cust Code],"Last Event date",MAXX(FILTER(ALL(Records),Records[Cust Code]=EARLIER(Records[Cust Code])), Records[Last Event date])),"Type Code",MAXX(FILTER(ALL(Records),Records[Cust Code]=EARLIER([Cust Code])&&Records[Last Event date]=EARLIER([Last Event date])),[Type code])),"type",LOOKUPVALUE(Records[type],Records[Cust Code],[Cust Code],Records[Last Event date],[Last Event date],Records[Type code],[Type Code]))
Create table visual with above result table:
Regards,
Xiaoxin Sheng
Hi @AGo,
You can refer to below steps to achieve your requirement:
Source table:
Table formula:
Result Table = ADDCOLUMNS(ADDCOLUMNS(SUMMARIZE(Records,Records[Cust Code],"Last Event date",MAXX(FILTER(ALL(Records),Records[Cust Code]=EARLIER(Records[Cust Code])), Records[Last Event date])),"Type Code",MAXX(FILTER(ALL(Records),Records[Cust Code]=EARLIER([Cust Code])&&Records[Last Event date]=EARLIER([Last Event date])),[Type code])),"type",LOOKUPVALUE(Records[type],Records[Cust Code],[Cust Code],Records[Last Event date],[Last Event date],Records[Type code],[Type Code]))
Create table visual with above result table:
Regards,
Xiaoxin Sheng
Thank you, it's perfect.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
97 | |
85 | |
67 | |
59 |
User | Count |
---|---|
150 | |
120 | |
100 | |
87 | |
68 |