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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
ryanb603
New Member

How to write an If-Then Statement Which Checks if a ChicletSlicer button is pressed

Hello,

 

I have python code which exports my data every time a change is made on the screen, but i want this code only to run if "Reviewed" is selected in the Chiclet slicer. I have 1 table in the project which has a column called "Column" which has "Reviewed" listed in ever row.

 

 

# The following code to create a dataframe and remove duplicated rows is always executed and acts as a preamble for your script:
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

datas=dataset

frame = pd.DataFrame(datas)
#IF "reviewed" is selected in the chiclet slicer, then:
      datas.to_csv(r'\\homedirpva1a01\USERSNC$\603225\chromdrivernew\powerbitest.csv',index=True)

 

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

@ryanb603 ,

If you want to check if there is a value selected in the slicer, use the ISFILTERED function.

Also, IF function for your reference.

 

Best Regards,
Community Support Team _ kalyj

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

3 REPLIES 3
v-yanjiang-msft
Community Support
Community Support

Hi @ryanb603 ,

Is your problem solved? If so, would you mind accept the helpful replies as solutions? Then we are able to close the thread. More people who have the same requirment will find the solution quickly and benefit here, thank you!

Best Regards,
Community Support Team _ kalyj

v-yanjiang-msft
Community Support
Community Support

@ryanb603 ,

If you want to check if there is a value selected in the slicer, use the ISFILTERED function.

Also, IF function for your reference.

 

Best Regards,
Community Support Team _ kalyj

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

mariussve1
Super User
Super User

Hi,

 

Are you asking how to write this in DAX?

If so;

IF ( HASONEFILTER ( Table[Column] ), TrueCondition, FalseCondition )

 

If DAX is not the case, I have no idea. Hehe

 

Br

Marius


Br
Marius
BI Fabrikken
www.bifabrikken.no

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.

Top Solution Authors