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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
bsz_29
New Member

How to use slicer partly on a python script based boxplot?

bsz_29_0-1667480385131.png

Figure 1. python implication of the problem

Hi, I want to make a visual on PBI based on the figure above. My dataset is like this:

 

bsz_29_1-1667480535267.png

Figure 2. dataset overview

 

So visual will show overall mean smape distribution among the data, but also a spesific 'series's mean smape value' that are selected via 'Series Slicer'.

To be more spesific, I want to choose one series from the slicer and want distribution to stay the same but highlight the point of the series' mean smape in the visual, just like in the first figure. 

My boxplot's python script code is below:

 

 

# The following code to create a dataframe and remove duplicated rows is always executed and acts as a preamble for your script: 

# dataset = pandas.DataFrame(series, mean smape)
# dataset = dataset.drop_duplicates()

# Paste or type your script code here:
import seaborn as sns
import matplotlib.pyplot as plt
sns.boxplot(y=dataset['mean smape'])
plt.show()

 

 

 

I hope I manage to make the problem clear. Appreciate your help!

 

Best regards.

1 REPLY 1
lbendlin
Super User
Super User

When you apply  filters in your data model to the fields in your Python visual the visual will recalculate accordingly and re-plot.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.