Forum Discussion

doubleclick's avatar
doubleclick
Icon for Resolver I rankResolver I
5 months ago
Solved

Dynamic Axis Re-labelling - tricky issue for a PBI PRO

I need some help from you PowerBi geniuses!

I'm building a supplier scorecard, the supplier is the user. I need to show the their data whilst anonymising the other supplier names into Supplier1, Supplier 2, etc. An example, a table with peformance metrics, the user will see their own data but other suppliers with have this anonymisation


I've managed this in a table using a measure and a parameter called Supplier Selector. However, I need to use this in a graph.

 

So, imagine there's the supplier spend on the Y, supplier name on the X, but the supplier name needs to be dynamic so it only shows the name of the selected supplier (via RLS but for now via a slicer) and for others it anonymises them by saying Supplier 2, Supplier 3, etc 

 

I've managed it on a row level context using a parameter, and can use that in a table, with some limitations, how can this be achieved??? Please help!

 

  • Hi doubleclick ,

    This isn’t something Power BI supports in native visuals. Axis categories must come from a column and those are resolved before any slicer driven logic (measures) is applied. That’s why your solution can highlight the selected supplier correctly but can’t replace just that one label dynamically.

    I suggest you keep your anonymised axis (Supplier 1, 2, 3…) and then use visual cues to identify the selected supplier, like colour (which you already have), plus a dynamic title, tooltip or data label that shows the real name. If you strictly need the axis label itself to switch to the real name, that would require a custom visual like Deneb, as it’s not achievable with standard Power BI charts.

    Best Regards, 
    Community Support Team 

6 Replies

  • Hi doubleclick  based on my understanding on the above described scenario I created the below visual 

    PBIX: Supplier Name.pbix

    OP


    Sample IP:
    Fact :


    Dim :


    Slicer table 


    datamodel :


    Dax:

    1) 
    DisplayName = 
    VAR _thisSpend = CALCULATE( SUM( SupplierFacts[Spend_GBP] ) )
    RETURN
        "Supplier " &
        RANKX(
            ALL( SupplierDim ),
            CALCULATE( SUM( SupplierFacts[Spend_GBP] ) ),
            _thisSpend,
            DESC,
            Dense
        )
    
    2)
    Rank =
    MAXX(
        FILTER(
            SupplierDim,
            SupplierDim[SupplierName]
                = SELECTEDVALUE( SupplierSelector[Supplier] )
        ),
        INT( MID( SupplierDim[DisplayName], 10, 2 ) )
    )
    
    
    3)
    IsSelectedSupplier = 
    VAR _currentName =
        MAXX(
            FILTER(
                SupplierDim,
                SupplierDim[DisplayName] = SELECTEDVALUE( SupplierDim[DisplayName] )
            ),
            SupplierDim[SupplierName]
        )
    VAR _selected = SELECTEDVALUE( SupplierSelector[Supplier] )
    RETURN
        IF( _currentName = _selected, "#7F77DD", "#D3D1C7" )
    TotalSpend = 
    CALCULATE(
        SUM( SupplierFacts[Spend_GBP] ),
        ALLSELECTED( SupplierDim[SupplierName] )
    )
    
    4)
    
    YouLabel = 
    VAR _name = SELECTEDVALUE( SupplierSelector[Supplier] )
    VAR _rank =
        MAXX(
            FILTER( SupplierDim, SupplierDim[SupplierName] = _name ),
            SupplierDim[DisplayName]
        )
    RETURN
        "You are: " & _name & "  (" & _rank & ")"



    Logic : 

    SupplierSelector is a disconnected table : no relationships to anything. The slicer on it purely captures the selected name via SELECTEDVALUE(SupplierSelector[Supplier]) without touching the data model's filter context.

     

    DisplayName is a calculated column on SupplierDim that ranks every supplier by spend and assigns a permanent anonymous label : Supplier 1, 2, 3 etc. This column is what sits on the chart axis, so all 5 bars always render regardless of slicer selection.


    IsSelectedSupplier is a measure that runs per bar it resolves the current bar's DisplayName back to the real supplier name, then checks if it matches the slicer selection. If yes : purple hex, if no : grey hex.


    YouLabel to bridge back : telling the logged-in supplier "you are Supplier 4" so they can locate themselves on the chart.

    Thanks 
    If you found this helpful, please consider giving it a kudo and marking it as the accepted solution — it goes a long way in helping others facing the same issue.

    For more Power BI tips and discussions, let’s connect on LinkedIn:
    https://www.linkedin.com/in/natarajan-manivasagan

    Cheers!


    • v-menakakota's avatar
      v-menakakota
      Icon for Community Support rankCommunity Support

      Hi doubleclick ,
      Thanks for reaching out to the Microsoft fabric community forum. 

      I would also take a moment to thank Natarajan_M  , for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference. 
      I hope the above details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We’re always here to support you.

       

      Best Regards, 
      Community Support Team

       

       

      • v-menakakota's avatar
        v-menakakota
        Icon for Community Support rankCommunity Support

        Hi doubleclick ,

        I hope the above details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We’re always here to support you.

        Best Regards, 
        Community Support Team

         

         

    • doubleclick's avatar
      doubleclick
      Icon for Resolver I rankResolver I

      This doesn't work fully, it doesn't show the selected supplier name, it only colours it in which isn't sufficient 

      • v-menakakota's avatar
        v-menakakota
        Icon for Community Support rankCommunity Support

        Hi doubleclick ,

        This isn’t something Power BI supports in native visuals. Axis categories must come from a column and those are resolved before any slicer driven logic (measures) is applied. That’s why your solution can highlight the selected supplier correctly but can’t replace just that one label dynamically.

        I suggest you keep your anonymised axis (Supplier 1, 2, 3…) and then use visual cues to identify the selected supplier, like colour (which you already have), plus a dynamic title, tooltip or data label that shows the real name. If you strictly need the axis label itself to switch to the real name, that would require a custom visual like Deneb, as it’s not achievable with standard Power BI charts.

        Best Regards, 
        Community Support Team