Forum Discussion

SatyaVaitla's avatar
SatyaVaitla
Icon for Advocate II rankAdvocate II
10 years ago
Solved

custom column created in data view not appearing in edit query view

i created a custom column with DAX. This is to combine 2 columns to create a new column. My second table also having these two columns and there also i created a similar custom column. now i combine ...
  • sdjensen's avatar
    sdjensen
    10 years ago

    If you tell us a little more about the columns you are trying to concatenate then we can help you with the code you need to do this.

     

    What are the names of the columns and what are their data type?

     

    if they are both text then it is pretty straight forward to do this. Just go to the Add Column pane and press Add Custom Column. Then give you column a name and in the Available columns locate the first column you want in your concatenated column and double click it then add a & and find the 2nd column and double click it and select okay.

     

    The final result could look something like this: = [column1] & [Column2]

     

    if you want some kind of delimiter between the 2 columns you can add this like this [column1] & "-" & [Column2]

     

    if any of the values are a number then you need to format this as a text in the formula you can do this with the Number.ToText function (and you need to right it like this - M is case sensitive so number.totext will return an error) - so lets say column1 is a number then the formula will be like this: Number.ToText([column1]) & "-" & [Column2]

     

    I hope this helps you a little... if you need help with M then this page have all the functions and shows examples of how to use them.