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.
I am running a Python script in Power BI which does some calculations and creates a table 'PythonTable'. This table is then used by a report. Somewhere in the script, this can be found:
overall=pd.concat([name,lang,cert],axis=1)
res = (df_multiply_modified(overall, overall.T)).stack().reset_index(level=1)
The code is using the variable 'overall' which combines some groups like name, lang cert. I would like to add a slicer which can select for example name and lang, so the script will change to:
overall=pd.concat([name,lang],axis=1)
And hence 'PythonTable' will be updated. I could also just choose name, so the script will be:
overall=pd.concat([name],axis=1)
How can I achieve this?
Thank you
If you want to pass a query parameter to python script, it is supported.
I made a simple demo for this, but it's not perfect. When switching to choose a parameter value which contains fewer or different columns, the steps below the Source step will probably report errors as they cannot find the missing columns to transform.
So I think dynamically changing the columns with parameters is probably not a good idea. It's suggested to contain all the necessary columns in the model, but select different columns for different visuals as you need in the report.
Kindly let me know if this helps.
Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.
How do you get to that screen?
@Anonymous It is Advanced Editor in Power Query Editor. Query overview in Power BI Desktop
If I guess correctly, your python table is a table query created by python script, right? If so, it is created first, then loaded into Power BI Desktop to create a report from. If you want to use a slicer in the report to dynamically change the columns in your python table, I'm afraid this is not supported. The slicers and filters in the report are not able to influence how a table query is created and transformed in the Query Editor.
Best Regards,
Community Support Team _ Jing Zhang
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
95 | |
80 | |
68 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |