Forum Discussion

cdcphist's avatar
cdcphist
Frequent Visitor
5 years ago
Solved

Rankx with filter ranks all rows

Hi,   I have the following data (an example):   value company category rank 50 A S 37 54 A S 41 40 A S 33 33 A S 30 50 A S 37 260 A S 60 295 A S 63...
  • Fowmy's avatar
    5 years ago

    cdcphist 

    Add the column as follows:

     

    rank = 
    VAR currentcompany ='Table'[company]
    VAR currentcategory ='Table'[category]
    var currentvalue='Table'[value]
    RETURN
    IF(
        'Table'[value] <> BLANK(),
        RANKX (FILTER ( 'Table', 'Table'[company] = currentcompany && 'Table'[category] = currentcategory && 'Table'[value]<> BLANK()), 'Table'[value],,ASC)
    )

     

     

  • Jihwan_Kim's avatar
    5 years ago

    Hi, cdcphist 

    Please try something like the below.

     

     

    rank CC =
    VAR currentC = 'Table'[company]
    VAR cuurentCat = 'Table'[category]
    RETURN
    IF (
    ISBLANK ( 'Table'[value] ),
    BLANK (),
    RANKX (
    FILTER (
    'Table',
    'Table'[company] = currentC
    && 'Table'[category] = cuurentCat
    && NOT ISBLANK ( 'Table'[value] )
    ),
    'Table'[value],
    ,
    ASC
    )
    )

     

     

    Hi, My name is Jihwan Kim.

     

    If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

     

    Linkedin: linkedin.com/in/jihwankim1975/

    Twitter: twitter.com/Jihwan_JHKIM