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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Python Slicer with New Parameter

Hey guys!

 

The goal of my visualisation is to get a slicer, that can filter my Python-visualisation of maxCurrentCutter and maxCurrentNormal. These two are columns in the table testDataCutter (screenshot below).

 

For now, I have created a new parameter with these two columns, called field_parameter. But I really don't know how to adapt my python code that it runs and filters as wished. Can sb help?

This is my code so far:

 

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

# Datetype of 'Date'
dataset['Date'] = pd.to_datetime(dataset['Date'])

# Plot  
plt.scatter(dataset['Date'], dataset['maxCurrentCutter'], color='green', s=10, label='maxCurrentCutter')
plt.scatter(dataset['Date'], dataset['maxCurrentNormal'], color='orange', s=10, label='maxCurrentNormal')


plt.title('Max Thread Cut Current')
plt.xlabel('Date')
plt.ylabel('[Ampere]]')
plt.grid(True)
# vertical Grid
#plt.gca().xaxis.grid(False)
plt.xticks(rotation=30)
plt.tight_layout()
plt.legend(loc='upper left')

plt.show()

 

dominicghr_0-1712655483819.png

dominicghr_1-1712655554227.png

dominicghr_0-1712655852084.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I think I found an appropriate solution. 

 

In the Power Query Editor, you have to convert the two columns (maxCurrentCutter & maxCurrentNormal) in into a Unipivot Column. Than you can select between maxCurrentCutter & -Normal in a slicer which will also affect the python code. 

 

The only problem with this method is, that the number of rows doubles, which can lead to performance issues on larger datasets.

 

Hope this helps somebody 🙂

 

 

from this...

dominicghr_0-1713162875354.png

 

 

 

 

 

 

 

 

 

 

to this ...

dominicghr_1-1713162906377.png

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

I think I found an appropriate solution. 

 

In the Power Query Editor, you have to convert the two columns (maxCurrentCutter & maxCurrentNormal) in into a Unipivot Column. Than you can select between maxCurrentCutter & -Normal in a slicer which will also affect the python code. 

 

The only problem with this method is, that the number of rows doubles, which can lead to performance issues on larger datasets.

 

Hope this helps somebody 🙂

 

 

from this...

dominicghr_0-1713162875354.png

 

 

 

 

 

 

 

 

 

 

to this ...

dominicghr_1-1713162906377.png

 

Anonymous
Not applicable

Hi @Anonymous ,

 

During my investigation I have found users in the past who have had similar experiences to you .

 

For original post, you may refer to

Solved: Power BI Slicer as What-If parameter in python scr... - Microsoft Fabric Community

 

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.

Anonymous
Not applicable

Hi @Anonymous 

 

Thanks for your message. I looked about these problems in the link but I think they had another problem to be solved. 

 

My problem is, that maxCurrentCutter & -Normal are Column Headers. So I can not make a normal slicer because than, there would be Values like 4.256, ... and not maxCurrentCutter for example. But for this case Power BI implementated the New Parameter function, which creates a new Table that you can use for slicer and for the visualisation. But I don't know how to implement the field_parameter (screenshot) into my Code instead of using maxCurrentCutter and maxCurrentNormal.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.