PowerBI:切片器以筛选表仅当选择多个值时 [英] PowerBI: Slicer to filter a table Only when more than 1 value is selected

查看:2999
本文介绍了PowerBI:切片器以筛选表仅当选择多个值时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张表格,其中包含5种类别,单位显示为2种类型,即实际和预算。

I have a table with 5 categories and units displayed into 2 types, Actual and budget.

我要过滤此表。仅在限幅器中选择2个或更多值时。这样的东西。

I want to filter this table. Only when 2 or more values are selected in the slicer. Something like this.

我虽然添加了一个量度,但不知道如何准确地运行if语句。

I though of adding a measure, but dont know how to work the if statement exactly.

Measure = IF(COUNTROWS(ALLSELECTED(Report[Shipment Group])) = 1, "Something which would not filter the units", SELECTEDVALUE(Report[Units], SUM(Report[Units])))

不知道这是正确的方法,想知道是否可以使用其他方法。任何帮助都会有所帮助。

Not sure if this is correct approach.Would like to know if any other approach is possible. Any help would be helpful. Thank you in advance.

推荐答案

这是一个奇怪的请求,但是我认为我有一些工作。

This is a bit of an odd request, but I think I have something that works.


  1. 首先,您需要为切片器值创建一个单独的表(否则您将无法控制所需过滤的方式)。您可以点击新表格按钮并将其定义如下:







Groups = VALUES(Report[Shipment Group])








  1. 将切片器设置为使用 Groups [Shipment Group] 代替 Report [运输组]

定义新度量,如下所示:

Define your new measure as follows:







Measure = IF(COUNTROWS(ALLSELECTED(Groups[Shipment Group])) = 1,
             SUM(Report[Units]),
             SUMX(FILTER(Report,
                         Report[Shipment Group] IN VALUES(Groups[Shipment Group])),
                  Report[Units]))

或等效地

Measure = IF(COUNTROWS(ALLSELECTED(Groups[Shipment Group])) = 1,
             SUM(Report[Units]),
             CALCULATE(SUM(Report[Units]),
                       FILTER(Report,
                              Report[Shipment Group] IN VALUES(Groups[Shipment Group]))))






注意:仔细检查Power BI是否没有自动在报告表格。你不要那样。


Note: Double check that Power BI has not automatically created a relationship between the Groups and Report tables. You don't want that.

这篇关于PowerBI:切片器以筛选表仅当选择多个值时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆