Forum Discussion
Can't create a text parameter
- Anonymous1 year ago
Thanks for the reply from 123abc , please allow me to provide another insight:
Hi, EmiOB
Thanks for reaching out to the Microsoft fabric community forum.Regarding the issue you raised, my solution is as follows:
You can try combining the parameter field with the SELECTEDVALUE() function. Here’s how you can do it:
Use report readers to change visuals (preview) - Power BI | Microsoft Learn
For example, my sample data includes multiple columns:1. Create two parameter fields as you need two slicers.
2.Since directly applying the SELECTEDVALUE() function to the parameter column may cause errors, it is recommended to create a calculated column for each parameter:
3.Create a measure to clearly identify the selected column name:
selection1 = SELECTEDVALUE('Parameter2'[Column n])selection2 = SELECTEDVALUE('Parameter'[Column n1])4. Use the two parameters and the two measures as inputs in the Python custom visual object:
5. Use the loc method to directly select the column..Here is my test Python code:
import matplotlib.pyplot as plt # Paste or type your script code here: dataset['Selected1'] = dataset.apply(lambda row: row.loc[row['selection1']], axis=1) dataset['Selected2'] = dataset.apply(lambda row: row.loc[row['selection2']], axis=1) # Create a figure and a subplot fig, ax = plt.subplots(figsize=(8, 3)) # Set the size of the chart # Hide the default x-axis and y-axis ax.xaxis.set_visible(False) ax.yaxis.set_visible(False) ax.set_frame_on(False) # Create a table, displaying only the Selected1 and Selected2 columns table = ax.table(cellText=dataset[['Selected1', 'Selected2']].values, colLabels=['Selected1', 'Selected2'], cellLoc='center', loc='center') # Adjust the table style table.auto_set_font_size(False) table.set_fontsize(10) table.scale(1.2, 1.2) # Display the chart plt.show()6.Here's my final result, which I hope meets your requirements.
Please find the attached pbix relevant to the case.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for taking the time to reply. I've seen a few places describe your method, however I don't have the drop down menu on the New parameter button:
When I click on it, this window comes up:
There doesn't seem to be any option for text/fields as I've seen in yours and others examples.
Also, is there no other way to get the value without having to type out each parameter in a DAX expression? I have about 90 options I'd like the user to select 2 of, so this would take a while (I could automate the DAX string in some python code if this is the only way).
Hi, EmiOB
Thanks for your quick response, please check if you have the following Settings enabled:
Also, you don't need to write every option in dax, you just need to select it at creation time:
For further details, please refer to the following link:
Use report readers to change visuals (preview) - Power BI | Microsoft Learn
Of course, if you have any new discoveries or questions, please feel free to get in touch with us.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- EmiOB1 year agoRegular Visitor
I don't have a preview features option in the options menu (I'm also missing Updates from your list too). I'm on the September 2023 version of BI if that makes any difference?
- Anonymous1 year agoNot applicable
Hi, EmiOB
Thank you for your quick reply.
As you can imagine, this is what has been updated throughout the year.It is recommended that you update your version according to your needs, here is the download link:
Download Microsoft Power BI Desktop from Official Microsoft Download Center
Here's what's updated for each version, and you can choose which version to update:
Previous monthly updates to Power BI Desktop and the Power BI service - Power BI | Microsoft Learn
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- EmiOB1 year agoRegular Visitor
Thank you for all your help. Unfortunately, our prod is still the 2023 version, so I can't upgrade mine until that has been upgraded, without risking capatability for my other existing reports. I've accepted your solution as it may be useful for someone else.