cancel
Showing results for 
Search instead for 
Did you mean: 
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-kalyj-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-kalyj-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-kalyj-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
Responsive Resident
Responsive Resident

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
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

BizApps LATAM 2023

Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

Power Platform Bootcamp

Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.