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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Solution Supplier
Solution Supplier

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors