Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
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.
Solved! Go to Solution.
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
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
Hi,Thanks for your time
i have tried using provide DAX, it is visual in black.
conditional formatting not working.
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
Hi,
Please find the data
Result needed, if in section(highlighted column) same topic will come for any particular location so that the value should be highligt in Red while selecting through slicer and in case none of location slected or multiple location selected resulted shold be default(value in black color)
Sr No. | Date | Region | Facility | Review Question # | Section | Remarks | GAP | Level | Status | Closure Date | Submitted On | Year | Column |
1 | 13-Feb-22 | North | DEL NOY | 05-04-2022 | Minimum requirements - Warehouse | DG & LiBa Stickers | GAP1 | Level1 | Close | 14-02-2022 | 14-10-2022 14:16:12 | 2022 | 2 |
2 | 20-Jan-22 | North | DEL RPO | 01-04-2022 | Minimum requirements - Warehouse | DG labels & Incompatibility poster | GAP1 | Level1 | Close | 31-01-2022 | 14-10-2022 14:18:37 | 2022 | 2 |
3 | 18-Jan-22 | North | DEL FDB | 03-01-2022 | General | Test & Certificates not available | GAP1 | Level1 | Close | 28-01-2022 | 14-10-2022 14:22:13 | 2022 | 2 |
4 | 31-Jan-22 | South | BLR BG1 | Emergency Procedures - Reporting | BG1 facility not tagged in RCIR | GAP1 | Level1 | Close | 10-02-2022 | 14-10-2022 14:24:00 | 2022 | 3 | |
5 | 08-Jan-22 | South | MAA EGM | 02-10-2022 | Emergency Procedures - Reporting | Emergency Contact Numbers not visible | GAP1 | Level1 | Close | 18-01-2022 | 14-10-2022 14:25:38 | 2022 | 3 |
6 | 21-Jan-22 | South | BLR HSR | 01-04-2022 | Minimum requirements - Warehouse | DG labels & Incompatibility poster | GAP1 | Level1 | Close | 02-02-2022 | 14-10-2022 14:29:24 | 2022 | 2 |
7 | 21-Jan-22 | South | BLR HSR | 02-10-2022 | Emergency Procedures - Reporting | Emergency Contact Details | GAP2 | Level1 | Close | 02-02-2022 | 14-10-2022 14:33:28 | 2022 | 3 |
8 | 09-Feb-22 | South | MAA GYO | Road Operations | CAT 12 Training for X Ray Screener | GAP1 | Level1 | Close | 19-02-2022 | 14-10-2022 14:35:34 | 2022 | 1 | |
9 | 09-Feb-22 | South | MAA GYO | Load Control and Ramp Procedures | To nominate at least one SVC Supervisor for CAT-6 | GAP2 | Level1 | Close | 19-02-2022 | 14-10-2022 14:36:52 | 2022 | 1 | |
10 | 09-Feb-22 | South | MAA GYO | Acceptance & Handling Procedures | DG acceptance sticker & LiBA. Both stickers are mixed | GAP3 | Level1 | Close | 19-02-2022 | 14-10-2022 14:39:48 | 2022 | 1 | |
11 | 15-Jan-22 | West | BOM VSO | Minimum Training Requirements | CAT 6 validity expired | GAP1 | Level1 | Close | 25-01-2022 | 14-10-2022 14:43:52 | 2022 | 1 | |
12 | 15-Feb-22 | West | BOM MPT | 06-01-2022 | General | CAT 4,5,7 Training Pending for 3 Staff | GAP1 | Level1 | Close | 25-02-2022 | 14-10-2022 14:46:12 | 2022 | 2 |
13 | 15-Feb-22 | West | BOM MPT | SLAs/Contracts | CAT 4,5,7 Training Pending for 3 Staff | GAP2 | Level1 | Close | 25-02-2022 | 14-10-2022 14:49:42 | 2022 | 1 | |
14 | 15-Feb-21 | West | BOM MPT | 06-01-2022 | General | CAT 4,5,7 Training Pending for 3 Staff | GAP2 | Level1 | Close | 20-08-2021 | 28-10-2022 14:16:57 | 2021 | 2 |
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
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
123 | |
78 | |
49 | |
38 | |
37 |
User | Count |
---|---|
196 | |
80 | |
70 | |
51 | |
42 |