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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
E5254730
Helper II
Helper II

Filter Chart as per Slicer Selection

Hello,

I have a Slicer which says Closed and Open.

Have created a measure to get COUNT from Service Agreement column

To get % of Closed, I've created below 3 measure. M3 basically gives us the %.

 

M1 = CALCULATE ( COUNTROWS ( Table), Table[Service Agreement] = "OK")
M2 = CALCULATE ( COUNTROWS ( Table ),Table[Service Agreement] = "NOT OK")
M3 = IF ( NOT ( HASONEVALUE ( Table[Status] ) ), DIVIDE([M2], [M1]))

 

 Below is how my Clustered Column chart is displayed:

E5254730_0-1685359975208.png

And, 3 more measure created to get count from a column called Present/Absent:

 

M4 = CALCULATE ( COUNTROWS ( Table), Table[Present/Absent] = "Present")
M5 = CALCULATE ( COUNTROWS ( Table ),Table[Present/Absent] = "Absent")
M6 = IF ( NOT ( HASONEVALUE ( Table[Status] ) ), DIVIDE([M5], [M4]))

 

Now when the Status Slicer is set to all - it does display the chart (like above)

But when we select Closed or Open from the Slicer - a blank chart gets displayed.

My requirement is - when Closed is selected - just display the one's in light blue.

If open - display the dark blue. If all - display both the Closed and open bars.

Have used M3 and M6 in the Y-axis.

Please advise.

1 ACCEPTED SOLUTION
v-yueyunzh-msft
Community Support
Community Support

Hi, @E5254730 

According to your description, you want to "when Closed is selected - just display the one's in light blue.If open - display the dark blue. If all - display both the Closed and open bars.".

 

For your need , i think we can not use the [Status] field in your table.

Here are the steps you can refer to :
(1)This is my test data:

vyueyunzhmsft_0-1685498563643.png

(2)We can create a new Table2 like this and we do not need to create any relationship between tables.

vyueyunzhmsft_1-1685498608560.png

(3)Then we can modify your M3 and M6 measures like this:

M3 = 
var _slicer = VALUES('Table2'[Status])
return
IF({"Closed"} in _slicer ,
DIVIDE([M2], [M1]))
M6 = 
var _slicer = VALUES('Table2'[Status])
return
IF({"Open"} in _slicer ,
DIVIDE([M5], [M4]))

 

(4)Then we can put the 'Table2'[Status] as the slicer and we can put the fields we need on the bar visual and we can meet your need , the result is as follows:

vyueyunzhmsft_2-1685498683833.png

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

View solution in original post

1 REPLY 1
v-yueyunzh-msft
Community Support
Community Support

Hi, @E5254730 

According to your description, you want to "when Closed is selected - just display the one's in light blue.If open - display the dark blue. If all - display both the Closed and open bars.".

 

For your need , i think we can not use the [Status] field in your table.

Here are the steps you can refer to :
(1)This is my test data:

vyueyunzhmsft_0-1685498563643.png

(2)We can create a new Table2 like this and we do not need to create any relationship between tables.

vyueyunzhmsft_1-1685498608560.png

(3)Then we can modify your M3 and M6 measures like this:

M3 = 
var _slicer = VALUES('Table2'[Status])
return
IF({"Closed"} in _slicer ,
DIVIDE([M2], [M1]))
M6 = 
var _slicer = VALUES('Table2'[Status])
return
IF({"Open"} in _slicer ,
DIVIDE([M5], [M4]))

 

(4)Then we can put the 'Table2'[Status] as the slicer and we can put the fields we need on the bar visual and we can meet your need , the result is as follows:

vyueyunzhmsft_2-1685498683833.png

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

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.

March Power BI Update Carousel

Power BI Community Update - March 2026

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