简体   繁体   中英

Can I generate 2 numbers from a single What-if parameter in Power BI?

I'm using a what-if parameter to filter a table. I'm trying to generate 2 number from this what-if parameter, as the visual "slicer" supports "between" selection and other multi-selection options.

What-If 参数显示两个数字之间的切片器

When I change from single value selection to multi-number selection, I can't get any value on Parameter Value . When I change back to single value selection, I can get the parameter value, as seen on the pictures.

多选,无参数值 单数选择,正确的参数值

Is it possible to use the What-if parameter to generate two (or more) numbers with this multi-selection?

PS. I really need to use parameters like this, like a "between slicer", as the top and bottom numbers will be used to filter a couple of different columns with rather complex rules.

Yes! That's possible!

You can notice that when you create a What-if parameter, the Parameter Value measure is created with the code like:

Parameter Value = SELECTEDVALUE('Parameter'[Parameter])

The SELECTEDVALUE function returns a single value from a list, that's why no value is returned when you select multiple ones.

Knowing that, you can create measures to get the MAX and MIN value of those listed on the parameter, like this:

Top parameter = MAX('Parameter'[Parameter])

and

Bottom parameter = MIN('Parameter'[Parameter])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM