Forum Discussion
Dynamic Axis Re-labelling - tricky issue for a PBI PRO
- 4 months ago
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
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!
This doesn't work fully, it doesn't show the selected supplier name, it only colours it in which isn't sufficient
- v-menakakota4 months agoCommunity 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- v-menakakota4 months agoCommunity 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