Forum Discussion

Gurpreetsingh1's avatar
10 months ago
Solved

RLS not working fine while using selected value in measure

I'm using RLS on the [OutputName] column (e.g., 'Mapping (SE)'[OutputName] = "B&FCommon"), and while the data is incorrectly filtered, my measure using SELECTEDVALUE('Mapping (SE)'[OutputName]) give incoorect value after RLS & When I manually select the value comes right Even with alternatives like DISTINCTCOUNT and MAX, the measure still doesn't recognize the RLS-filtered value. How can I get the selected [OutputName] value from RLS without requiring manual selection?

  • Hi everyone,
    I’ve found the solution to this issue. When we use the SELECTEDVALUE function in a measure, it doesn’t return the correct result under RLS, since RLS only filters rows and doesn’t actually make a selection.
    To fix this, I used the HASONEVALUE function instead, which works correctly for all users and ensures that RLS returns accurate results.
    Thanks 

5 Replies

  • Shahid12523's avatar
    Shahid12523
    Community Champion

    SELECTEDVALUE doesn’t work well with RLS unless a slicer is used. Instead,

    use:


    OutputName_RLS = CALCULATE(MAX('Mapping (SE)'[OutputName]))


    This grabs the RLS-filtered value directly, even without manual selection.

    • Gurpreetsingh1's avatar
      Gurpreetsingh1
      Helper I

      I cannot use min or max in measure becoz i have bith +ve and -ve values , so is there any other way to use this in a right way 

  • Shahid12523's avatar
    Shahid12523
    Community Champion

    OutputName_RLS =
    CALCULATE(
    FIRSTNONBLANK('Mapping (SE)'[OutputName], 1)
    )

    • Gurpreetsingh1's avatar
      Gurpreetsingh1
      Helper I

      I tried this ,it is filtering right cost center but value of measure is wrong only coming true by selecting manually.

  • Hi everyone,
    I’ve found the solution to this issue. When we use the SELECTEDVALUE function in a measure, it doesn’t return the correct result under RLS, since RLS only filters rows and doesn’t actually make a selection.
    To fix this, I used the HASONEVALUE function instead, which works correctly for all users and ensures that RLS returns accurate results.
    Thanks