使用powerbi中的dax或powerquery从表中的特定行返回值

发布于 2025-01-26 17:15:03 字数 310 浏览 3 评论 0原文

我有一个简单的桌子,有两列和无数行,然后将其拉到PowerBi桌面上。我想创建两个措施,第一个从表的第1列1中检索值的措施,第二列是从第2列第2行检索值的第二个措施。我可以使用什么DAX表达式或在PowerQuery中可以做的事情?谢谢你!

表的示例:

Column1   |  Column2
----------------------
Date         Country
Price        Close Time
Manager      Customer

措施1需要返回:[日期]措施2需要返回:[关闭时间]

I have a simple table that has two columns and numerous rows that I pulled into PowerBi desktop. I want to create two measures, the first to retrieve the value from row 1 column 1 of the table and the second to retrieve the value from row 2 of column 2. What DAX expression can I use OR is there something I can do in PowerQuery? Thank you!

Example of table:

Column1   |  Column2
----------------------
Date         Country
Price        Close Time
Manager      Customer

Measure 1 needs to return: [Date] Measure 2 needs to return: [Close Time]

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

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

发布评论

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

评论(1

帅哥哥的热头脑 2025-02-02 17:15:03

不确定您要去哪里,但是如果您的列是示例中的命名,则(在电源查询M代码中):

let
    Source = Excel.CurrentWorkbook(){[Name="Raptor"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}}),

    #"Row1 Column1" = #"Changed Type"[Column1]{0},
    #"Row2 Column2" = #"Changed Type"[Column2]{1}
in
    {#"Row1 Column1",#"Row2 Column2"}

则返回带有这些值的2个元素列表

如果您不知道列名, ,则您可以使用以下内容:

let
    Source = Excel.CurrentWorkbook(){[Name="Raptor"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}}),

    x = Table.ToColumns(#"Changed Type"),
    r1c1 = x{0}{0},
    r2c2 = x{1}{1}
in 
    {r1c1,r2c2}

以上两个=>

Not sure where you are going with this, but if your Columns are named as they are in your example, then (in Power Query M code):

let
    Source = Excel.CurrentWorkbook(){[Name="Raptor"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}}),

    #"Row1 Column1" = #"Changed Type"[Column1]{0},
    #"Row2 Column2" = #"Changed Type"[Column2]{1}
in
    {#"Row1 Column1",#"Row2 Column2"}

returns a 2 element list with those values

If you don't know the column names, then you can use something like:

let
    Source = Excel.CurrentWorkbook(){[Name="Raptor"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}}),

    x = Table.ToColumns(#"Changed Type"),
    r1c1 = x{0}{0},
    r2c2 = x{1}{1}
in 
    {r1c1,r2c2}

Both of the above =>
enter image description here

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