简体   繁体   English

如何创建过滤器,以过滤Power BI可视表上的度量“生成”的值? 可能吗?

[英]How can I create a filter that filter values “generated” by a measure on a visual table on Power BI? Is it possible?

I have the following visual table on Power BI. 我在Power BI上具有以下可视表。

在此处输入图片说明

  • %Sold o/ Estimated %售出/估计
  • Word

Were a MEASURES and calculated line by line on visual table, I don't have %Sold o/ Estimated and Word on my database. 在可视表上是一种MEASURES和逐行计算的情况下,我的数据库中没有%Sold o / EvaluatedWord

Word shows 2 values only. Word仅显示2个值。 "Nice" for %Sold o/ Estimated between 100% and 51% and "Bad" between 50% and 0%. 占售出百分比的 “不错”, 估计介于100%和51%之间,“差”介于50%和0%之间。

I need to create a filter (Slicer) that contains the 2 words ("Nice" and "Bad") and when user choose "Nice", the table only shows de lines with Word = "Nice". 我需要创建一个包含2个单词(“ Nice”和“ Bad”)的过滤器(切片器),当用户选择“ Nice”时,该表仅显示Word =“ Nice”的行。

I can't set "Nice" and "Bad" for Subcategorys on database, its calculated by a measure on visual table. 我无法为数据库中的子类别设置“好”和“差”,它们是通过可视表上的度量来计算的。

Is it possible to do? 有可能吗?

Create a new table of the words you want to use in the slicer. 创建一个新表,其中包含您要在切片器中使用的单词。 You can input it using Enter Data or defining a new table like this: 您可以使用Enter Data或如下定义新表来输入:

Labels = DATATABLE("Words", STRING, {{"Nice"}, {"Bad"}})

In any case, it's just this simple table: 无论如何,这只是这个简单的表:

Words
-----
Nice
Bad

Use that column to create your slicer and then adjust your Word measure to take into account the slicer selection(s). 使用该列创建切片器,然后调整Word度量以考虑切片器的选择。 For example, if your measure was 例如,如果您的措施是

Word = IF([%Sold o/ Estimated] > 0.5, "Nice", "Bad")

then let's modify it so it returns blank when the output isn't one of the selected words. 然后让我们对其进行修改,以便在输出不是所选单词之一时返回空白。

Word = 
VAR Label = IF([%Sold o/ Estimated] > 0.5, "Nice", "Bad")
RETURN IF(Label IN VALUES(Labels[Words]), Label, BLANK())

This will make unselected words return blanks in your table. 这将使未选中的单词在表中返回空白。 The final step is to add a visual level filter so that rows with blank Word values are excluded. 最后一步是添加视觉级别过滤器,以便排除具有空白Word值的行。

可视级过滤器

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

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