Forum Discussion

yewling1201's avatar
yewling1201
Frequent Visitor
4 years ago
Solved

Sum the Amount and Get the Name

Hi everyone,

 

Using DAX, how do I get the Salesperson name who has the least Sales Amount? 

AmountName
3.984Edward
3.1825Denise
12.7415John
3.992Philips
12.7415Edward
12.7415Elvin
4.731Denise

Eg: sum the sale amount 1st for every salesperson, I want to have the Salesperson with least salesamount, ie Phillips.

AmountName
16.7255Edward
7.9135Denise
12.7415John
3.992Philips
12.7415Elvin

 

Thank you in advance!

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi yewling1201 ,

     

    • Method1: Without DAX, just apply TopN filter to the Card visual:

     

    • Method2: Using RANKX()
    Rank = RANKX(ALL('Table'),CALCULATE(SUM('Table'[Amount]),ALLEXCEPT('Table','Table'[Name])),,ASC,Dense)​
    who has the least Sales Amount = CALCULATE(MAX('Table'[Name]),FILTER('Table',[Rank]=1))

    Output:

    Best Regards,
    Eyelyn Qin
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi yewling1201 ,

     

    • Method1: Without DAX, just apply TopN filter to the Card visual:

     

    • Method2: Using RANKX()
    Rank = RANKX(ALL('Table'),CALCULATE(SUM('Table'[Amount]),ALLEXCEPT('Table','Table'[Name])),,ASC,Dense)​
    who has the least Sales Amount = CALCULATE(MAX('Table'[Name]),FILTER('Table',[Rank]=1))

    Output:

    Best Regards,
    Eyelyn Qin
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • JMD22Si's avatar
    JMD22Si
    Frequent Visitor

    Couldn't you just put the two values in a table, sum the Amount and sort decending?

  • yewling1201's avatar
    yewling1201
    Frequent Visitor

    Hi,

     

    I only need to have the name of the Salesperson. and display in the Card Visual.

     

    Thank you!