- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
dynamic conditional formatting with virtual table and switch
Hi, im having an issue building dynamic conditional formatting on my visual (color columns)
The reason why i need to build that are all spaces in between columns in a chart, if more trafo numbers are selected than the spaces gets bigger
To do that i added a table with ColorID and HEX rgb.
I want to build virtual table with all selected Serial Numbers from slicer, adding HEX rgb by matchin the ID from virtual table and colorID
and then with switch return HEX rgb. The problem i have is that it always return same hex rgb with index nr 1
IndexColorTrafo =
var CurrentSelection=MAX(MeasurementsByFrequency[Serial Number])
VAR SelectedTrafoIDs = VALUES(MeasurementsByFrequency[Serial Number])
VAR NumSelectedTrafoIDs = COUNTROWS(SelectedTrafoIDs)
VAR VirtualTable =
ADDCOLUMNS(
GENERATESERIES(1, NumSelectedTrafoIDs),
"TrafoID", SELECTEDVALUE(MeasurementsByFrequency[Serial Number]),
"ColorID", LOOKUPVALUE(TblCSSColor[Hex rgb],TblCSSColor[ColorID],[Value])
)
RETURN
VAR Output= MAXX(
VirtualTable,
//VAR CurrentTrafoID = [TrafoID]
//RETURN
IF(
NumSelectedTrafoIDs = 0,
BLANK(),
SWITCH(
TRUE(),
//[TrafoID]=CurrentSelection,
CONTAINSSTRING(SelectedTrafoIDs, CurrentSelection),
[ColorID],
BLANK()
)
)
)
Return
Output
anyone can help?

Helpful resources
Join our Fabric User Panel
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Power BI Monthly Update - June 2025
Check out the June 2025 Power BI update to learn about new features.
