Forum Discussion

chotu27's avatar
chotu27
Post Patron
6 years ago
Solved

replacing column values based on slicer slection

  Sample data: Category Datamasking Values Intensive Care sub3 67 Laon Care sub1 23 Medical Care sub2 35           Output required:   Suppose user selects Loancare from...
  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi chotu27

    I build a table like yours to have test.

    We need to build a new Slicer table by Category column.

    Slicer = VALUES('Table'[Category])

     

    Then build a slicer.

    Build a measure to achieve your goal.

    Output =
    
    VAR _selectvalue =
    
        SELECTEDVALUE ( 'Slicer'[Category] )
    
    RETURN
    
        IF (
    
            MAX ( 'Table'[Category] ) = _selectvalue,
    
            MAX ( 'Table'[Category] ),
    
            CALCULATE (
    
                MAX ( 'Table'[Datamasking] ),
    
                FILTER ( ALL ( 'Table' ), 'Table'[Category] = MAX ( 'Table'[Category] ) )
    
            )
    
        )

     

    Result:

    Default:

    Select Laon Care:

    You can download the pbix file from this link: Replacing column values based on slicer slection

     

    Best Regards,

    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.