Forum Discussion

amsrivas's avatar
amsrivas
Helper IV
5 years ago
Solved

How to capture single column value from table in Text

Hi Folks!!

I have a table with one column say Country and it has just one value (always) say INDIA, though the name name of the country can be changes but number of rows remains 1.

 

I just want to capture this value in Text variable in Power BI M Query.

 

Please suggest!!

Thanks

Amit 

  • You can use Table{0}[Column] to refer to it (use your table and column names).

    You can put it in a variable with an assignment e.g.

    p = TableA{0}[Column1]

  • amsrivas's avatar
    amsrivas
    5 years ago

    Hi HotChilli ,

     

    Thanks for your answer, it works well.

    p = TableA{0}[Column1]

     

    However, i too find some other way out to achieve the goal, below is the code.

    varName=Table.FirstValue(TableName)

     

    This will give first column of first row.

     

    Thanks

    Amit Srivastava

2 Replies

  • HotChilli's avatar
    HotChilli
    Community Champion

    You can use Table{0}[Column] to refer to it (use your table and column names).

    You can put it in a variable with an assignment e.g.

    p = TableA{0}[Column1]

    • amsrivas's avatar
      amsrivas
      Helper IV

      Hi HotChilli ,

       

      Thanks for your answer, it works well.

      p = TableA{0}[Column1]

       

      However, i too find some other way out to achieve the goal, below is the code.

      varName=Table.FirstValue(TableName)

       

      This will give first column of first row.

       

      Thanks

      Amit Srivastava