Forum Discussion
What-If Parameter with Dynamic Range
- 10 months ago
Hello, I wanted to let everyone know I found a solution to this problem by following the steps outlined in this post:
https://www.sqlbi.com/articles/how-to-enable-the-single-value-option-in-a-power-bi-slicer/
If one has used Tabular Editor, which I have, the solution is incredibly simple. All you have to do is edit an extended property on the numeric column you wish to use. Any numeric column can be used in a single-value slicer, and it will be responsive to filters as any other field would.
For my solution, I had to add a few steps to (create multiplier values, crossjoin) to get a range of values. A bit of extra work, but the solution fits my needs perfectly.
Hopefully this will help someone.
Hi pbi_dot_edu
Thank you for reaching out to the Microsoft Fabric Community Forum regarding your issue.
The best approach to achieve your requirement is by using a disconnected table as suggested by lbendlin , as What-If parameters are static and do not respond dynamically to filter context. The key challenge here is that GENERATESERIES() does not accept dynamic min/max values, making it unsuitable for creating a dynamically adjusting range.
To achieve the desired functionality,
1. Define a table that contains a reasonable range of cost values. This will act as the source for the slicer.
2. Develop a measure that dynamically calculates the min and max values for the selected city and filters the slicer accordingly.
3. Use the measure to ensure that only relevant values within the selected city’s range are displayed in the slicer.
If my response has resolved your query, please mark it as the Accepted Solution to assist others. Additionally, a 'Kudos' would be appreciated if you found my response helpful.
Thank You.