简体   繁体   English

我可以从 Power BI 中的单个假设参数生成 2 个数字吗?

[英]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.我正在尝试从这个假设参数生成 2 个数字,因为视觉“切片器”支持“之间”选择和其他多选选项。

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

When I change from single value selection to multi-number selection, I can't get any value on Parameter Value .当我从单值选择更改为多数选择时,我无法在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?是否可以使用What-if参数通过这种多选生成两个(或更多)数字?

PS. 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. SELECTEDVALUE function 从列表中返回单个值,这就是当您 select 多个值时没有返回值的原因。

Knowing that, you can create measures to get the MAX and MIN value of those listed on the parameter, like this:知道了这一点,您可以创建度量来获取参数上列出的MAXMIN ,如下所示:

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

and

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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