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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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