PowerBi:图表中的动态维度:计算的列在切片机中修改输入参数时不会更新

发布于 2025-01-30 01:17:20 字数 520 浏览 2 评论 0原文

pbix文件:

我想使用户能够在PBI桌面上进行模拟。颜色与ID相关联,具体取决于ID的风险评分,并且用户可以在报告中使用的阈值。用户应该能够根据所选阈值来查看每种颜色的ID量如何变化。

数据选项卡的屏幕截图

”数据选项卡的屏幕截图

报告选项卡的屏幕截图

=“ nofollow noreferrer”>

pbix file : https://drive.google.com/file/d/1x6u9a1vamiWnaTgJY-yYTIpANlz2FXyn/view?usp=sharing

I want to enable the user to do a simulation in PBI desktop. A color is associated to an ID depending on the risk score of the ID and a threshold the user can play with in the report. The user should be able to see how the amount of IDs per color changes depending on the threshold chosen.

Screenshot of Data tab

Screenshot of Data tab

screenshot of report tab

screenshot of report tab

I have tried using a calculated column, but as RADO pointed out, calculated columns cannot be impacted by filter changes, measures or parameters. I tried a measure which updates fine, but I cannot figure how to use this "color" measure as a axis in the plot I am trying to make.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

挽手叙旧 2025-02-06 01:17:21

首先是一个小笔记:我将您的“表”重命名为“数据”,因为“表”是一个保留的名称;我还将自己的名字用于这些措施,并根据需要更改它们。

为分数颜色创建尺寸表:(

Score Colors = { "Red", "Green" }

它类似于阈值表 - 断开连接的表)。

创建总量的度量:

Total Amount = SUM( Data[Amount] )

创建定义分数颜色的度量。细微差别:您应该在总数中要谨慎。我选择不在总体上显示颜色,因为这没有道理。

Score Color =
VAR Selected_Threshold = [Threshold Value]
VAR Current_Score = SELECTEDVALUE ( Data[Risk score] )
VAR Result = IF ( Current_Score > Selected_Threshold, "Green", "Red" )
RETURN
    IF ( NOT ISBLANK ( Current_Score ), Result )

最后,创建一个通过动态颜色计算得分量的度量:

Dynamic Chart =
VAR Current_Color = SELECTEDVALUE ( 'Score Colors'[Color] )
VAR Result =
    SUMX (
        VALUES ( Data[ID] ),
        IF ( [Score Color] = Current_Color, [Total Amount] )
    )
RETURN
    Result

它的工作原理:我们在ID列表上迭代,计算其得分颜色,并将其与图表轴上的颜色进行比较。如果它们匹配,则将金额添加到结果中。

最后,从X轴上的表“得分颜色”和y轴上的[动态图表]测量的表“得分颜色”创建图表:

“

结果:

i.sstatic.net/iixmo.png“ rel =“ nofollow noreferrer ” a href =“ https://i.sstatic.net/u9bxk.png” rel =“ nofollow noreferrer”>

A small note first: I renamed your 'Table' into 'Data', since 'Table' is a reserved name; I also used my own names for the measures, change them as necessary.

Create a dimension table for score colors:

Score Colors = { "Red", "Green" }

(it's similar to the Threshold table - a disconnected table).

Create a measure for total amount:

Total Amount = SUM( Data[Amount] )

Create a measure that defines score color. A nuance: you should be careful about what you want to see in the totals. I chose not to show color in the totals as it makes no sense.

Score Color =
VAR Selected_Threshold = [Threshold Value]
VAR Current_Score = SELECTEDVALUE ( Data[Risk score] )
VAR Result = IF ( Current_Score > Selected_Threshold, "Green", "Red" )
RETURN
    IF ( NOT ISBLANK ( Current_Score ), Result )

Finally, create a measure that calculates score amount by color dynamically:

Dynamic Chart =
VAR Current_Color = SELECTEDVALUE ( 'Score Colors'[Color] )
VAR Result =
    SUMX (
        VALUES ( Data[ID] ),
        IF ( [Score Color] = Current_Color, [Total Amount] )
    )
RETURN
    Result

How it works: we iterate over the list of IDs, compute their score colors, and compare to the color on the chart axis. If they match, amount is added to the result.

Finally, create a chart with Color field from the table "Score Colors" on x-axis, and [Dynamic Chart] measure on y-axis:

enter image description here

Result:

enter image description here

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文