Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
MiriamMattar
Frequent Visitor

Conditional formatting with multiple filtering option

Hi

can anyone help me on this one. I am trying to highlight the payments values according to certain costs. My table contains payments for different departments each has a different price. School fees and Bus fees for example.

I could do that if I filter out the table to School fees only or Bus fees only in two seperate table visuals. How can I do that in just one table combining both?

Schoolfees.PNGBusfees.PNGBus&School fees.PNG

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @MiriamMattar , please try the following measures, don't forget to modify the amount data in IF statements.

 

Sum Payment = SUM ( Payments[Payments] )

KPI BG+SG 2 = 
VAR __service = SELECTEDVALUE ( Payments[Service] )
VAR __payment = [Sum Payment]
RETURN
    SWITCH (
        __service,
        "School-fees",
            IF (
                __payment >= 30,
                "#008000",
                IF (
                    __payment >= 20 && __payment < 30,
                    "#ffa500",
                    IF ( __payment < 20, "#ff0003" )
                )
            ),
        "Bus-fees",
            IF (
                __payment >= 300,
                "#008000",
                IF (
                    __payment >= 200 && __payment < 300,
                    "#ffa500",
                    IF ( __payment < 200, "#ff0003" )
                )
            )
    )

Test result:

v-jingzhang_0-1602052278822.png

 

Best Regards,

Community Support Team _ Jing Zhang

If this post helps, please consider Accept it as the solution to help other members find it.

View solution in original post

3 REPLIES 3
v-jingzhang
Community Support
Community Support

Hi @MiriamMattar , please try the following measures, don't forget to modify the amount data in IF statements.

 

Sum Payment = SUM ( Payments[Payments] )

KPI BG+SG 2 = 
VAR __service = SELECTEDVALUE ( Payments[Service] )
VAR __payment = [Sum Payment]
RETURN
    SWITCH (
        __service,
        "School-fees",
            IF (
                __payment >= 30,
                "#008000",
                IF (
                    __payment >= 20 && __payment < 30,
                    "#ffa500",
                    IF ( __payment < 20, "#ff0003" )
                )
            ),
        "Bus-fees",
            IF (
                __payment >= 300,
                "#008000",
                IF (
                    __payment >= 200 && __payment < 300,
                    "#ffa500",
                    IF ( __payment < 200, "#ff0003" )
                )
            )
    )

Test result:

v-jingzhang_0-1602052278822.png

 

Best Regards,

Community Support Team _ Jing Zhang

If this post helps, please consider Accept it as the solution to help other members find it.

Thank you so much! This worked just great @v-jingzhang 

amitchandak
Super User
Super User

@MiriamMattar , Have a condition on bus and school fee so that those conditions are reachable

 

Also, use Switch True(), like

Switch(True() ,

[Service]  ="Bus Fee" , Switch(True() ,
							_sch_fee <=30000, "#ff00ff",
							//condition 2,
							//condition 3,
							//else
							),
[Service]  ="School Fee" , Switch(True() ,
							_sch_fee <=30000, "#ff00ff",
							//condition 2,
							//condition 3,
							//else
							)		
)	

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.