Dax for returning Text Column value

Hi Team,

Hope you are doing well.

Scenario: I have table which has customer name and various tickets they have logged. I have created a measure that calculates the number tickets that are open.

Tickets Open =
CALCULATE(
COUNT(Tickets[Ticket ID],
Tickets[Open Tickets] = ā€œYā€

I then have a measure to return the highest number of open tickets for a customer:

TopOpenNum =
CALCULATE([Tickets Open],
FILTER(VALUES(Tickets[Customer Name]),
IF( RANKX( ALL(Tickets[Customer Name]),
[Tickets Open], DESC ) <=1, [Tickets Open] , BLANK() )))

What Iā€™m trying to figure out is a measure that will return the name of the customer that has the highest ticket.
TopOPenCust = ?

Can any Dax wizards in the house please help me?

I want to use these measures in a smart narrative:

{TopOPenCust } was the customer that raised highest number of tickets ({TopOpenNum })

As per the attached image (sample data), the above would be

USA was the customer that raised highest number of tickets (2)

Any help would be appreciated :slight_smile:

Many ThanksSample Data

@Suraaj
Try the following:

Top Customer Name =
VAR Top1 =
    TOPN (
        1,
        SUMMARIZE ( Table, Table[Customer Name], "@Tickets", [# Of Tickets] ),
        [@Tickets], DESC
    )
VAR Result =
    CONCATENATEX ( Top1, Table[Customer Name], " " )
RETURN
    Result

Thanks.

3 Likes

@MudassirAli
That worked like magic. Thanks heaps :grinning:

1 Like