Forum Discussion

kjshah5030's avatar
kjshah5030
Frequent Visitor
8 years ago
Solved

Dax Top 1 Name

 

Hello Everyone,

I am a new to Power BI, I need a help for Dax , I have matrix table , table image is given below 

so , I want to top 1 GICS Level name using High Banchmark End Weight , want result is like ('Financials') bacause in financial Banchmark End Weight value is higher the others , how can I get value of top 1 GICS Level
Can anyone help me ?


and yes I also tried with this


CALCULATE([EndWeightBanchmark],FILTER(VALUES(ContributionCategory[SECTOR]),RANKX(ALL(ContributionCategory[SECTOR]),[EndWeightBanchmark],,DESC)=1))
But I am getting 23.17 not name of GICS Level

Here, ContributionCategory[SECTOR] is GICS Level which is coming from ContributionCategory
and [EndWeightBanchmark] is Measure column

  • kjshah5030

     

    Try with

     

    =
    CALCULATE (
        MAX ( [GICS Level] ),
        FILTER (
            VALUES ( ContributionCategory[SECTOR] ),
            RANKX ( ALL ( ContributionCategory[SECTOR] ), [EndWeightBanchmark],, DESC ) = 1
        )
    )

8 Replies

  • Zubair_Muhammad's avatar
    Zubair_Muhammad
    Icon for Community Champion rankCommunity Champion

    kjshah5030

     

    Try with

     

    =
    CALCULATE (
        MAX ( [GICS Level] ),
        FILTER (
            VALUES ( ContributionCategory[SECTOR] ),
            RANKX ( ALL ( ContributionCategory[SECTOR] ), [EndWeightBanchmark],, DESC ) = 1
        )
    )
    • kjshah5030's avatar
      kjshah5030
      Frequent Visitor

      Hi

      Zubair_Muhammad Thank you very much for kind reply , this is useful for mw  , I got my result as i expected 
      Thanks again

    • kjshah5030's avatar
      kjshah5030
      Frequent Visitor

      Hi
      Zubair_Muhammad, one more think for above example , 
      How can I ignore blank value and whatever result got on second or third those rank start as first ,

      For instance, we do have 10 values , out of it first three value is blank, and I want 4th value connsider as a first rank. How can I get it? Please do let me know ASAP. 

      • Zubair_Muhammad's avatar
        Zubair_Muhammad
        Icon for Community Champion rankCommunity Champion

        kjshah5030

         

        I think you will need to modify the table parameter of RANKX

        But not sure

         

        RANKX(CALCULATETABLE(VALUES(ContributionCategory[SECTOR]),[VALUES]<>BLANK())