Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Sign up nowGet Fabric certified for FREE! Don't miss your chance! Learn more
I have a couple of slicers in my report that are built from columns in unrelated tables. I want to get the values selected in those two slicers from my Python script and execute a calculation based on these selections. How can I get the values of my slicers in my Python script?
Solved! Go to Solution.
Add these columns to the values well of your Python visual. They will then be part of the dataframe.
Hi @lg01 ,
You can use DAX functions such as SELECTEDVALUE or VALUES to capture selected values. For example:
SelectedValue = SELECTEDVALUE(Table1[Column1])
Values = Values(Table2[Column2])
import pandas as pd
import matplotlib.pyplot as plt
df = dataset
selected_value1 = df['SelectedValue'].iloc
selected_value2 = df['Values'].iloc
result = selected_value1 + selected_value2
print(result)
Hope it helps!
Best regards,
Community Support Team_ Scott Chang
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Hi @lg01 ,
You can use DAX functions such as SELECTEDVALUE or VALUES to capture selected values. For example:
SelectedValue = SELECTEDVALUE(Table1[Column1])
Values = Values(Table2[Column2])
import pandas as pd
import matplotlib.pyplot as plt
df = dataset
selected_value1 = df['SelectedValue'].iloc
selected_value2 = df['Values'].iloc
result = selected_value1 + selected_value2
print(result)
Hope it helps!
Best regards,
Community Support Team_ Scott Chang
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Add these columns to the values well of your Python visual. They will then be part of the dataframe.
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 61 | |
| 58 | |
| 45 | |
| 21 | |
| 18 |
| User | Count |
|---|---|
| 119 | |
| 116 | |
| 37 | |
| 34 | |
| 30 |