Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powerbi 基于切片器的动态桶_Powerbi - Fatal编程技术网

Powerbi 基于切片器的动态桶

Powerbi 基于切片器的动态桶,powerbi,Powerbi,我有这张桌子 usr box app device bucket bucket_box bucket_app bucket_box_app month u1 b1 a1 d1 > 3 3 devices 2 devices 2 devices 201809 u1 b1 a1 d2 > 3 3 devices 2 devices 2 devices 201809 u

我有这张桌子

usr box app device  bucket      bucket_box  bucket_app  bucket_box_app  month
u1  b1  a1  d1      > 3         3 devices   2 devices   2 devices       201809
u1  b1  a1  d2      > 3         3 devices   2 devices   2 devices       201809
u1  b1  a2  d3      > 3         3 devices   2 devices   1 device        201809
u1  b2  a2  d4      > 3         1 device    2 devices   1 device        201809
u2  b1  a1  d5      > 3         1 device    2 devices   1 device        201809
u2  b2  a3  d6      > 3         2 devices   1 device    1 device        201809
u2  b2  a4  d7      > 3         2 devices   1 device    1 device        201809
u2  b3  a1  d8      > 3         1 device    2 devices   1 device        201809
u3  b3  a1  d9      3 devices   2 devices   2 devices   1 device        201809
u3  b4  a1  d10     3 devices   1 device    1 device    1 device        201809
u3  b3  a2  d11     3 devices   2 devices   2 devices   1 device        201809
我在列应用程序上创建了两个切片器。 在聚集柱状图中,在值上,我有不同的usr计数。 在图例中,我想按设备计算usr的细分。铲斗包括1台设备、2台设备、3台设备以及3台以上的设备

如果切片器中没有选择:
  • 计数不同usr=3
  • 2个usr->超过3个设备
  • 1个usr->3个设备
如果b1用作过滤器:
  • 计数不同usr=2
  • 1个usr->3个设备
  • 1个usr->1个设备
如果a1用作过滤器:
  • 计数不同usr=3
  • 3个usr->2个设备
如果a1和b1用作过滤器:
  • 计数不同usr=2
  • 1个usr->2个设备
  • 1个usr->1个设备
我该怎么做

以后编辑

我对源表做了一点修改,使其与现在的完全相同。 您可以从以下站点下载报告:
我想要一个动态的分组计数。每次筛选切片器时,usr都应该有一个计数(设备)组,然后根据此计数生成存储桶:当前筛选器上有多少用户有1个设备、2个设备、3个设备或3个以上设备。我在axis上放了“月”列,但它与本例无关,因为它只有一个值。

正如我前面提到的,这个问题本质上是重复的:

您需要为您的类别创建一个新表
bucket

Bucket
------
1 device
2 devices
3 devices
>3 devices
获得该值后,将其放入图例框中,并对值框使用以下度量值:

DynamicBucketingMeasure =
    VAR Summary =
        SUMMARIZE (
            ALLSELECTED ( pbi_box_active_devices_4 ),
            pbi_box_active_devices_4[usr],
            "Devices", DISTINCTCOUNT ( pbi_box_active_devices_4[device] )
        )
    VAR Bucketed =
        ADDCOLUMNS (
            Summary,
            "Bucket", SWITCH (
                TRUE (),
                [Devices] > 3, ">3 devices",
                [Devices] = 1, "1 device",
                [Devices] & " devices"
            )
        )
    RETURN
        SUMX ( Bucketed, IF ( [Bucket] = SELECTEDVALUE ( Buckets[Bucket] ), 1, 0 ) )

请注意,在这个度量中,我将计数和随后的扣扣分为两个步骤,而不是像在链接问题中那样将它们合并为一个步骤。

Super!当我不使用轴上的月份时,它工作正常。在一个更大的数据集上,有更多月份的数据,在所有轴值上,它将所有数据相加。因此,所有铲斗组都具有相同的数据。我尝试通过以下方式向group中添加month列:

VAR Summary =
    SUMMARIZE (
        ALLSELECTED ( pbi_box_active_devices_4 ),
        pbi_box_active_devices_4[usr],
        pbi_box_active_devices_4[month],
        "Devices", DISTINCTCOUNT ( pbi_box_active_devices_4[device] )
    )

但它没有按预期工作。

我无法想象您希望图表的外观。你能做一个你描述的第一个或第二个案例的模型吗?我把原来的帖子改了一点。你也可以在那里找到报告来源。这个问题与我几天前回答的问题性质非常相似: