简体   繁体   English

如何按 Power BI 中的度量筛选结果

[英]How do I filter results by a measure in Power BI

I need to be able to filter by a measure to show more granular results in Power BI.我需要能够按度量筛选以在 Power BI 中显示更精细的结果。 I would like to be able to choose where the percentage is in a range, or = 100%我希望能够选择百分比在一个范围内的位置,或者 = 100%

My calculation for the measure is this (each column can only be 1 or 0):我对度量的计算是这样的(每列只能是 1 或 0):

errorPercentage = CALCULATE(SUM([missing data])/SUM([expected]))

This works fine in the table and correctly shows the percentage which can be cut in many different ways.这在表格中工作正常,并正确显示了可以以多种不同方式削减的百分比。

However, when adding a filter element/visual, Power BI wont let me use the errorPercentage measure.但是,在添加过滤器元素/视觉对象时,Power BI 不会让我使用 errorPercentage 度量。

What is more confusing is that if I go to the Visual Level Filters section on the table I want to filter, I CAN use the errorPercentage measure to filter in a range or value.更令人困惑的是,如果我转到要过滤的表上的 Visual Level Filters 部分,我可以使用 errorPercentage 度量在范围或值中进行过滤。

Can anyone suggest an easy to use filter?谁能推荐一个易于使用的过滤器? I'm trying to let the users of the report choose a % range themselves, rather than having a pre-defined one.我试图让报告的用户自己选择一个百分比范围,而不是预先定义一个范围。

You can't use an aggregated measure as a slicer.您不能将聚合度量用作切片器。 A slicer filters a dataset to all tuples that participate in the selected values of a given dimension.切片器将数据集过滤为参与给定维度的选定值的所有元组。 A measure is not a dimension.度量不是维度。 It cannot be used to identify subsets of records.它不能用于识别记录的子集。

Suppose I had data on basketball players and I wanted to slice to the set of players whose 'Average Free throw percentage' was 85%.假设我有篮球运动员的数据,我想切分到“平均罚球命中率”为 85% 的一组球员。 Think about all of the different subsets of players who would have such an average!想想所有拥有如此平均水平的球员的不同子集! Maybe we have "Player A" with 90 percent who could be matched with one "Player B" who scores 80 percent of his free throws -- they average 85% (assuming that they have taken the same number of total throws each).也许我们有 90% 的“球员 A”可以与一名得分为 80% 的“球员 B”相匹配——他们的平均罚球命中率为 85%(假设他们每人的总罚球次数相同)。 Or, "Player A" could be grouped with 5 other players whose percent is 84 percent.或者,“玩家 A”可以与其他 5 个玩家的百分比为 84% 分组。 But those same 5 players wouldn't be part of the set without "Player A" - so are they or aren't they part of the desired subset?但是,如果没有“玩家 A”,那 5 名玩家就不会成为该系列的一部分——那么他们是否属于所需的子集? It's ambiguous.这是模棱两可的。

You can create a calculated column that specifies where each value falls within a % range using a simple switch calculation.您可以创建一个计算列,使用简单的开关计算来指定每个值在百分比范围内的位置。 Once this column exists you can use it as a slicer;一旦此列存在,您就可以将其用作切片器; if the data is not contiguous you can always create a table that encompasses the entire range of values and join on that column and use that table as a slicer.如果数据不连续,您始终可以创建一个包含整个值范围的表并连接该列并将该表用作切片器。

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

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