Forum Discussion

Iamnvt's avatar
Iamnvt
Continued Contributor
7 years ago
Solved

Manual Data input for calculated columns

hi,

 

how can I enter a data manually for a calculated column in DAX? I know we can do that easily with Enter Data table in Power Query; however, I am wondering if we have an DAX function that let me enter the data manuallly for a calculated column.

input is:

column name: X

Row 1: a

Row 2: b

...

 

Thanks

  • Hi Iamnvt 

    Open Edit queries, create an index column (from 1) for the exsiting table

    Then close&&apply,

    in the data model,

    Create a column

    Column = SWITCH([Index],1,"a",2,"b",3,"c",4,"d")

     

    Best Regards
    Maggie

     

    Community Support Team _ Maggie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

3 Replies

  • v-juanli-msft's avatar
    v-juanli-msft
    Community Support

    Hi Iamnvt 

    Open Edit queries, create an index column (from 1) for the exsiting table

    Then close&&apply,

    in the data model,

    Create a column

    Column = SWITCH([Index],1,"a",2,"b",3,"c",4,"d")

     

    Best Regards
    Maggie

     

    Community Support Team _ Maggie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Hi,

     

    You could try and use the dax function DATATABLE like the example below

    TestData = DATATABLE(
         "Store", STRING, 
         "Sales", INTEGER,
    
    { 
           {"Store 1",3500000}, 
           {"Store 2",4500000},
           {"Store 3",1115500}, 
           {"Store 4",1225540},
           {"Store 5",6433000} 
    }
    )

     

    • Iamnvt's avatar
      Iamnvt
      Continued Contributor
      Hi,

      This function doesnt work with calculated column.
      It creates a new table!

      I have a table already, now I just want to categorize some of the value in the table manually.