Forum Discussion
Passing between parameters to a measure using Whatif Analysis
- 8 years ago
Hi Krishna_Mysore,
As I know, currently it is not supported to use multi valued parameter in Power BI desktop. It also means that we can only refer a single value parameter in measure, not the parameter range.
So to achieve your requirement, I think we need do some workarounds. Like define two parameters, one used for the MIN value and one is for the MAX value. Then use two parameters in measure.
Or, you can just use the between mode Slicer to filter data. Please refer: Use the numeric range slicer in Power BI Desktop
Thanks,
Xi Jin. - 8 years ago
Hi Krishna_Mysore,
When you use a measure since it's based on context it returns an error.
Try to change your measure to something like this:
Avg Selling Price Filtered Range = VAR av_price = [Avg Selling Price (Billed) Monthly] RETURN CALCULATE ( [Avg Selling Price (Billed) Monthly], FILTER ( Table, av_price >= MIN ( Parameter[Parameter] ) && av_price <= MAX ( Parameter[Parameter] ) ) )Change Table by the name of the table that as your data.
Regards,
MFelix
Hi Krishna_Mysore,
You want to use the what if analysis but it's not only with one value, you want to have a range so in this case the measure that is created automatically won't solve your issue, you need to change your slicer of the what if analysis to a between and then make the formula as I mention because that will get the top and lowest value on your waht if.
Regards,
MFelix
I have
1 Set my paratmeters slicer to between range.
2 Applied your suggested formula.
I endup with the above error when I try to incorporate the MIN and MAX funtion agasinst the parameter table.
- MFelix8 years ago
Super User
Hi Krishna_Mysore,
You have the wrong column name in your formula, in the part where you have:
MIN(Parameter[Parameter Value]) MAX(Parameter[Parameter Value])
You should put the table parameter name and the corresponding column looking at your print screen I assume should be something like this:
MIN(Parameter[Parameter]) MAX(Parameter[Parameter])
Not sure if the table name is correct because I can only see the column name choosen in your slicer. To what I can read on the first post you made the Parameter Value is the calculated measure when you have the what if analysis for a single value.
As a good practice in DAX you should do the following notations when refering to an object:
Column = Table[Column]
Measure = [Measure]
This means if you use a column in your calculations you should always refer the table name making it context, if it's a measure you should only use the measure name.
Regards,
MFelix
- Krishna_Mysore8 years ago
Helper II
Hi MFelix
I didnt realise that I was not referrring to the correct column name in my measure. Nevertheless I made the correction now but still it doesnt work.
Below are the images of my parameter table and the measure with error.
- MFelix8 years ago
Super User
Hi Krishna_Mysore,
When you use a measure since it's based on context it returns an error.
Try to change your measure to something like this:
Avg Selling Price Filtered Range = VAR av_price = [Avg Selling Price (Billed) Monthly] RETURN CALCULATE ( [Avg Selling Price (Billed) Monthly], FILTER ( Table, av_price >= MIN ( Parameter[Parameter] ) && av_price <= MAX ( Parameter[Parameter] ) ) )Change Table by the name of the table that as your data.
Regards,
MFelix