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.
Hello all,
I'm trying to create a calculated column to display a "True" text for the last agent who handeled a customer ticket.
Current table:
Customer ID | Agent | Date |
111 | A | 20/02 |
111 | B | 23/04 |
111 | C | 02/05 |
222 | Y | 01/09 |
222 | X | 11/10 |
222 | F | 12/10 |
333 | D | 07/02 |
333 | Y | 03/11 |
Ideal situation:
Customer ID | Agent | Date | Last Agent? |
111 | A | 20/02 | |
111 | B | 23/04 | |
111 | C | 02/05 | True |
222 | Y | 01/09 | |
222 | X | 11/10 | |
222 | F | 12/10 | True |
333 | D | 07/02 | |
333 | Y | 03/11 | True |
I tried several ways but none worked out well. I appricate your help in advance.
Solved! Go to Solution.
Hi @Anonymous ,
You can create a calculated column as below:
Last Agent? =
VAR _maxdate =
CALCULATE (
MAX ( 'Table'[Date] ),
FILTER ( 'Table', 'Table'[Customer ID] = EARLIER ( 'Table'[Customer ID] ) )
)
RETURN
IF ( 'Table'[Date] = _maxdate, "True" )
Best Regards
Hi @Anonymous ,
You can create a calculated column as below:
Last Agent? =
VAR _maxdate =
CALCULATE (
MAX ( 'Table'[Date] ),
FILTER ( 'Table', 'Table'[Customer ID] = EARLIER ( 'Table'[Customer ID] ) )
)
RETURN
IF ( 'Table'[Date] = _maxdate, "True" )
Best Regards
@Anonymous , A new column
if([Date] = maxx(filter(Table, [Customer ID] =max([Customer ID]) ),[Date]) , true(), blank())
Thank you for your answer, I've just tried it and it didn't work out. It's showning me that all recrods are false. This DAX doesn't filter based on the agent.
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 |
---|---|
107 | |
96 | |
77 | |
66 | |
53 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |