英文:
Using measured value as x-axis
问题
我正在使用PowerBI Desktop Report-Server。
我有一个产品表,其中存储了不同的设备类型和它们的序列号。
在给定情况下,序列号不是唯一的。这意味着每个序列号可以用于不同的设备类型。我的问题是,我必须构建序列号的分组,用户可以更改大小。用户还可以更改分组的数量。
使用一个度量值,我可以计算每个序列号的分组号。
分组 = floor((maxx(Product, Product[SN]) ) / [selectedBinSize], 1) + 1
现在我想显示一个堆叠柱状图,显示分组(序列号范围),但我找不到一种使用度量值作为X轴的方法。
所有的文章都说这不会起作用,但也许有一种隐藏的方法。由于我已经使用Power BI实现了一个解决方案(不能使用!)使用参数(绑定到分组大小和数量的切片器值),但Power BI报告服务器不支持参数。
如果您知道一种方法,请告诉我。
热情问候
英文:
i am using PowerBI Desktop Report-Server.
I have a product table where different device type are stored with it serial number.
In the given case the serial numbers aren't unique. That means that each serial number can be used for device type. My issue is that I have to build serial number bins where the user can change the size. The user also change the count of bins.
With a measure I can calculate the bin number for each serial number.
Bin = floor((maxx(Product, Product[SN]) ) / [selectedBinSize], 1) + 1
Now I wanna show a stacked column chart with the bins (sn-ranges) but I find no way to use the measuerd bin values as x-axis.
Looklike for target target (created with PowerBI Desktop (NOT Resport Server Version)
All articles say that this will not work, but maybe there is a hidden way. Since I realized a solution with power bi (which can't be used!) using parameters (bound to slicer value of bin size and count), but power bi report server do not support parameters.
Please let me know when you know a way.
Warm regards
答案1
得分: 0
抱歉,我只会翻译文本内容,不会执行代码。以下是翻译好的内容:
-
创建一个与其他表无关的表,其中包含您的箱子列表。
-
创建一个度量来执行您想要的逻辑,跨越箱子和产品组合。
Bins
[箱子] |[箱子大小]
--------+----------
1234 |5
度量
SUMX(
箱子,
SUMX(
FILTER(
产品,
FLOOR( DIVIDE( 产品[SN] / 箱子[箱子大小], 1) + 1 = 箱子[箱子]
),
产品[SN]
)
)
这将返回所选箱子中的所有序列号。它会遍历每个箱子和产品,只有在逻辑为真时才汇总 SN。在这里,我假设 [selectedBinSize]
是一个引用箱子属性列 (箱子[箱子]
) 的箱子大小。根据您的环境,您可能需要进行微调,但这是解决此类问题(动态分箱)的基本方法。
英文:
Caveat, I am not familiar with Power BI Report Server, but this solution should work in Power BI Desktop.
-
Create a table unrelated to any other with a list of your bins.
-
Create a measure to perform the logic you are wanting across the bins and product combinations.
Bins
[Bin] |[Bin Size]
--------+----------
1234 |5
Measure
SUMX(
Bins,
SUMX(
FILTER(
Product,
FLOOR( DIVIDE( Product[SN] / Bin[BinSize], 1) + 1 = Bins[Bin]
),
Product[SN]
)
)
This will give return all serial numbers in the selected bin. It iterates through each bin and product, and only aggregates SN where the logic is true. Here I assumed [selectedBinSize]
is referencing a bin attribute column (Bins[Bin]
). You may need to tweak based on your environment, but this is the basic approach to this type of problem (dynamic binning).
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论