使用PowerBi Dax创建动态计算的列

发布于 2025-02-12 00:08:34 字数 935 浏览 1 评论 0原文

我是PowerBi的新手,在创建一个计算出的列方面,我面临着一个挑战,该列将随着数据集被过滤而自动更新。我的数据集看起来像这样 -

“数据集映像”

我已经使用公式创建了ablevarable_milestone_match列 -

Deliverable_Milestone_Match = 
IF(
    Sheet1[Issue_Type] = "CO Deliverable", 
    VAR _sel = SELECTCOLUMNS(
        Sheet1, 
        "MilestoneIssueKey", 
        [Issue_Key]
    ) 
    RETURN 
    IF(
        Sheet1[MilestoneIssueKey] IN _sel, 
        "MAPPED",
        "UNMAPPED"
    ),
    "MILESTONE"
)

现在,挑战是,我需要在此数据集中应用一些过滤器,并且由于我的计算列引用了其他列中的其他列,数据,它也需要相应更改。例如,该公式正在查找esseage_key中MilestoneIssuekey的存在,如果匹配匹配,则填充映射,否则将其取消启动。现在,如果我应用一个删除特定唯一essue_key的过滤器,则相应的MilestoneIssueKey将不再具有匹配项,并且deliverable_milestone_match值现在应该更改为未上限。

如果有人可以帮助我,我将不胜感激。我什至不确定是否可以通过DAX实现这一点,或者我是否需要为此使用电源查询。

提前致谢!

I am new to PowerBI and I am facing a challenge with creating a calculated column that will get updated automatically as the dataset keeps getting filtered. My dataset looks like this -

Dataset Image

I have created the Deliverable_Milestone_Match column using the formula -

Deliverable_Milestone_Match = 
IF(
    Sheet1[Issue_Type] = "CO Deliverable", 
    VAR _sel = SELECTCOLUMNS(
        Sheet1, 
        "MilestoneIssueKey", 
        [Issue_Key]
    ) 
    RETURN 
    IF(
        Sheet1[MilestoneIssueKey] IN _sel, 
        "MAPPED",
        "UNMAPPED"
    ),
    "MILESTONE"
)

Now, the challenge is, that I will need to apply some filters to this dataset, and since my calculated column references other columns in the data, it also needs to change accordingly. For example The formula is looking up the presence of MilestoneIssueKey in Issue_Key, and it is populating MAPPED if it gets a match, and UNMAPPED otherwise. Now, if I apply a filter that removes a specific unique Issue_Key, then the corresponding MilestoneIssueKey won't have a match anymore, and the Deliverable_Milestone_Match value should change to UNMAPPED now.

I would appreciate it if anyone can help me with this. I am not even sure if this can be achieved via DAX or whether I will need to use Power Query for this.

Thanks in advance!

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

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

发布评论

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

评论(1

橘香 2025-02-19 00:08:35

您的第一个问题是以下内容:

[...]计算的列,随着数据集的过滤

将自动更新

计算出的列不会随着滤波器上下文的发展而自动更新计算出的列。正如解释的那样在这里

由于计算出的列与表格相同,因此仅在您第一次定义它们和数据集刷新期间才能计算它们。

因此,在这方面,您应该尝试使用措施来解决问题。

You first issue is the following:

[...] calculated column that will get updated automatically as the dataset keeps getting filtered

Calculated columns aren't refreshed dynamicaly as filter context evolves. As explained here :

Since calculated columns live at the same level as your tables, they are only calculated when you first define them and during a dataset refresh.

So, in that regard you should try to solve your problem using Measures.

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