Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

HOW DO I DO RANKX with table without group by column in Transforrm data

Hello everyone,

 

I have a table bellow: 

Table 1

Customer_IDCustomer NameNo.InvoiceIn Due dateDebt over 1-30 daysDebt over 31-60 daysDebt over 61 days
CS0001Customer 1INV00011239884128841012380130 
CS0001Customer 1INV000288210430 1204 
CS0002Customer 2INV0003 238581283892423 
CS0002Customer 2INV00041283848394812389423389284
CS0001Customer 1INV0005834923838876673729349 
CS0003Customer 3INV00068854898384790547292988741
CS0003Customer 3INV00077837298347239733289 

 

I want to visualize the table like below:

Table 1_Result

Company NameTotal DebtRank
Cusomter 11957572041
Customer 3284427782
Customer 2277505513

 

I have 1 solution for doing that, is using Group by column for each column then add custom column to calculate total debt in the Transform data then I use RANKX

 

But I want to improve my knowledge, does anyone have any solution to do this by only using measures?

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

     

    Please try:

    Total Debt =
    CALCULATE (
        SUM ( 'Table'[Debt over 1-30 days] ) + SUM ( 'Table'[Debt over 31-60 days] )
            + SUM ( 'Table'[Debt over 61 days] )
            + SUM ( 'Table'[In Due date] ),
        ALLEXCEPT ( 'Table', 'Table'[Customer Name] )
    )
    
    Rank = RANKX(ALLSELECTED('Table'),[Total Debt],,DESC,Dense) 

     

    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

    Anyone have suggestion for me? 

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    Please try:

    Total Debt =
    CALCULATE (
        SUM ( 'Table'[Debt over 1-30 days] ) + SUM ( 'Table'[Debt over 31-60 days] )
            + SUM ( 'Table'[Debt over 61 days] )
            + SUM ( 'Table'[In Due date] ),
        ALLEXCEPT ( 'Table', 'Table'[Customer Name] )
    )
    
    Rank = RANKX(ALLSELECTED('Table'),[Total Debt],,DESC,Dense) 

     

    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.