'Return a value from a specific row in a table using DAX or PowerQuery in PowerBi

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]



Solution 1:[1]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1