Forum Discussion
Conditional Formatting based on Slicer
Hello Everyone,
I need help in conditional formatting based on Slicer in Power BI.
Having a small dataset(mostly text formatted) and want to show the data in Table like, if i slect location and if section haveing same topic twice, then topice show highligted in RED, else in black.
I have created view, but only challange here if i am selecting location from slicer and there is multple topic in section column then result showing in RED, but as soon slecting multiple value or selecting all it is also considering all value and showing in RED., whereas i want it calculte based on selection, if selected location have same topic in section colum then show in red else default or in case multiple location selected also show as deafult color(black).
Measures that i have used
View without selectio or all selected which i want as Black
View to single selected location and its correct.
- Anonymous3 years ago
HI hasharma19,
You can use the following measure formula at 'conditional formatting' ->'font color' with 'field value' mode to setting color formatting based current Facility and Section:
Colorcode = VAR currFacility = SELECTEDVALUE ( 'Table'[Facility] ) VAR currSection = SELECTEDVALUE ( 'Table'[Section] ) VAR summary = SUMMARIZE ( ALLSELECTED ( 'Table' ), [Facility], [Section], "SC", COUNT ( 'Table'[Section] ) ) VAR rowCount = COUNTROWS ( FILTER ( summary, [Facility] = currFacility && [Section] = currSection && [SC] > 1 ) ) RETURN IF ( rowCount > 0, "Red", "Black" )Apply conditional table formatting in Power BI - Power BI | Microsoft Learn
Regards,
Xiaoxin Sheng
5 Replies
- AnonymousNot applicable
Hi hasharma19,
You can try to use the following measure formal to get the row count of current facility based on selection values:
formula = VAR currFacility = SELECTEDVALUE ( Table[Facility] ) VAR summary = SUMMARIZE ( FILTER ( ALLSELECTED ( Table ), [Section] IN VALUES ( Table[Section] ) ), [Facility], [Section], "SC", COUNT ( Table[Section] ) ) RETURN COUNTROWS ( FILTER ( summary, [Facility] = currFacility && [SC] > 1 ) )Regards,
Xiaoxin Sheng
- hasharma19Helper II
Hi,Thanks for your time
i have tried using provide DAX, it is visual in black.
conditional formatting not working.
- AnonymousNot applicable
Hi hasharma19,
Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng