Forum Discussion

chock974's avatar
chock974
Frequent Visitor
2 months ago
Solved

Anonymized data

Hi, I have an expensive table with each individual's rank. I would like to display an individual's data and their rank relative to all other (while anonymizing ths identites of the others).   I sh...
  • oussamahaimoud's avatar
    2 months ago

    If your goal is to have the anonymized ranking table and the ±5 bar chart shown in your screenshots, driven by a single slicer on EXENUM. , you can try this solution step by step:

     

    Step 1: Parameter (selected individual)

    Create a "What-if" parameter or a disconnected table for the selected PS:

    SelectedPS = SELECTEDVALUE('Table'[EXENUM])

    Or use a slicer directly on EXENUM.

     

    Step 2: Calculated column for display label

    Identifiant Display = 

    VAR SelectedEXE = SELECTEDVALUE('Table'[EXENUM])

    RETURN

    IF(

        'Table'[EXENUM] = SelectedEXE,

        VALUE(FORMAT('Table'[EXENUM], "0")) & " - vous",

        "PS anonymisé"

    )

     

    Step 3: Écart vs vous measure

    Écart vs Vous = 

    VAR SelectedMNT = 

        CALCULATE(

            MAX('Table'[TOT_MNT]),

            FILTER(ALL('Table'), 'Table'[EXENUM] = SELECTEDVALUE('Table'[EXENUM]))

        )

    VAR CurrentMNT = MAX('Table'[TOT_MNT])

    RETURN

    IF(

        MAX('Table'[EXENUM]) = SELECTEDVALUE('Table'[EXENUM]),

        BLANK(),

        CurrentMNT - SelectedMNT

    )

     

    Step 4: Filter to ±5 ranks (for the bar chart)

    IsInScope_±5 = 

    VAR SelectedRank = 

        CALCULATE(

            MAX('Table'[RG_MNT]),

            FILTER(ALL('Table'), 'Table'[EXENUM] = SELECTEDVALUE('Table'[EXENUM]))

        )

    RETURN

    ABS('Table'[RG_MNT] - SelectedRank) <= 5

    Use this as a visual-level filter (IsInScope_±5 = TRUE) on both the table and the bar chart.

     

    Step 5: Conditional formatting (gold color for "vous")

    Create a measure for bar color:

    Bar Color = 

    IF(

        MAX('Table'[EXENUM]) = SELECTEDVALUE('Table'[EXENUM]),

        "#F0B429", -- gold

        "#3B6FC4" -- blue

    )

    Apply it in the bar chart → Columns → fx → Field value → Bar Color.

     

    Table visual setup:

    Column | Value

    RANG | RG_MNT

    IDENTIFIANT | Identifiant Display

    TOT_MNT | TOT_MNT

    ÉCART VS VOUS | Écart vs Vous

     

    Finally, you sort by RG_MNT ascending. Add conditional formatting on Écart vs Vous: positive = green, negative = red.