Forum Discussion

Paramjit's avatar
Paramjit
Helper II
4 years ago
Solved

Measure in Slicer

Hi Team,

 

 

I have the below measure and need to use in the Slicer but unable to do. Could you pleaes help.

 

Range = CALCULATE(if([Rank 2]/MAXX(ALLSELECTED('Table'),[Rank 2])*100>67,"Long Jobs",
if([Rank 2]/MAXX(ALLSELECTED('Table'),[Rank 2])*100>33,"Mediam Jobs","Short Jobs")))

 

Rank 2= RANKX(ALLSELECTED('Table'),CALCULATE(SUM('Table'[Average])),,ASC)

 

I am creating the Rank measure on Average column and then Range  measure (or precentile) as above.

 

Anonymous 
amitchandak 
SivaMani 
Icey 

ryan_mayu 

Greg_Deckler 

 

Thank you,

Paramjit

  • Paramjit, Try the below approach and let me know if it meets your requirement,

     

    • Keep [Rank 2] Measure
    • Create a table

     

     

    • Check the below logic and create a measure 

     

    Range = 
    VAR __Max = MAXX( ALL(<TableName>[ColumnName]),[Rank 2])
    VAR __SelValue = SELECTEDVALUE('Table'[Name])
    VAR __Perc = DIVIDE([Rank 2],__Max)
    
    RETURN
    SWITCH(
        TRUE(),
        __SelValue = "Long" && __Perc > .67,"Y",
        __SelValue = "Medium" && __Perc > .33, "Y",
        __SelValue="Short", "Y"
        )

     

    •  Add Range to Visual Level Filter and apply Range is 'Y'
    • Add Name(from step 2) to slicer
    • Test it

    Hope it will help you!

     

     

    Best Regards,
    Siva Mani
    Proud to be a Super User!
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

     

5 Replies

  • Paramjit , For slicer you have create an independent table with these value and then filter it in a measure 

     

    assume table name RangeBucket

     

    New measure = sumx(filter(Values(Table[Run ID]), [Range] = max(RangeBucket[Value]) ), CALCULATE(SUM('Table'[Average])) )

     

    Dynamic Segmentation Bucketing Binning
    https://community.powerbi.com/t5/Quick-Measures-Gallery/Dynamic-Segmentation-Bucketing-Binning/m-p/1387187#M626


    Dynamic Segmentation, Bucketing or Binning: https://youtu.be/CuczXPj0N-k

    • Paramjit's avatar
      Paramjit
      Helper II

      amitchandak 

       

      i tried the same but it is duplicating the values. 

       

      I am not able to filter out the null values.  Please suggest.

       

       

       

       

      itchandak 

  • SivaMani's avatar
    SivaMani
    Resident Rockstar

    Paramjit, Try the below approach and let me know if it meets your requirement,

     

    • Keep [Rank 2] Measure
    • Create a table

     

     

    • Check the below logic and create a measure 

     

    Range = 
    VAR __Max = MAXX( ALL(<TableName>[ColumnName]),[Rank 2])
    VAR __SelValue = SELECTEDVALUE('Table'[Name])
    VAR __Perc = DIVIDE([Rank 2],__Max)
    
    RETURN
    SWITCH(
        TRUE(),
        __SelValue = "Long" && __Perc > .67,"Y",
        __SelValue = "Medium" && __Perc > .33, "Y",
        __SelValue="Short", "Y"
        )

     

    •  Add Range to Visual Level Filter and apply Range is 'Y'
    • Add Name(from step 2) to slicer
    • Test it

    Hope it will help you!

     

     

    Best Regards,
    Siva Mani
    Proud to be a Super User!
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.