简体   繁体   English

如何在 Power BI 中按行小计过滤矩阵?

[英]How to filter matrix by row subtotals in Power BI?

I have a matrix that shows flight data and travellers names, with totals to show how many passengers are on each flight.我有一个显示航班数据和旅客姓名的矩阵,总计显示每次航班上有多少乘客。 I need to be able to filter this table down by the row totals so that only those with 2+ travellers are shown, but I cannot figure out how to do so since the count will always show as 1 for each line.我需要能够按行总数过滤此表,以便只显示有 2 个以上旅行者的人,但我不知道该怎么做,因为每行的计数始终显示为 1。 在此处输入图像描述

When you use a matrix visual and show the count of travelers, it is essentially an implied measure.当您使用矩阵视觉显示旅客人数时,它本质上是一种隐含的度量。 You can't place a measure in a filter because the calculation will vary depending on the context of the visual.您不能在筛选器中放置度量,因为计算会因视觉对象的上下文而异。

You can create a calculated table that summarizes the flight data.您可以创建一个汇总航班数据的计算表 You can then use the "Travelers" field from this new table in a numeric filter.然后,您可以在数字过滤器中使用这个新表中的“Travelers”字段。

Summary Table = SUMMARIZE(Flights,Flights[Flight Number], "Travelers", Count(Flights[Traveler]))

结果

While the calculated table provides the expected results, it won't inherit filter context from the visual so this solution.虽然计算表提供了预期的结果,但它不会从视觉对象中继承筛选器上下文,因此此解决方案。 Best solution is below.最佳解决方案如下。

Passenger Per Flight Filter = 
IF(
   [Passenger per Flight] <> BLANK(),
   CALCULATE( [Passenger per Flight], ALL( 'Dim Traveller' ) ),
   BLANK()
)

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

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