Forum Discussion

rmeng's avatar
rmeng
Helper II
6 years ago
Solved

Custom Column IF Statement with Concatenation

I want a Custom Column with a IF Statement like this:

 

if [counts] = "Yes" then [date]&[mdm ID]&[User ID] else null

Can you Help me?

 

 

 

 

 

 

  • Hi, rmeng 

     

    You need to use 'Text.From' function to change the date types of '[Date]', '[mdm ID]', '[User ID]' as text before the concatenation. The pbix file is attached in the end.

     

    I created data to reproduce your scenario.

    Table:

     

    Then you may create a custom column as below.

    if [Counts]="Yes" then Text.From([Date])& Text.From([mdm ID])&Text.From( [User ID]) else null

     

     

    Result:

     

    Best Regards

    Allan

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

     

2 Replies

  • AlB's avatar
    AlB
    Community Champion

    Hi rmeng 

    The code that you show looks good. Doesn't it work? What is the problem?

    You'd just have to create a custome column in the query and add your code. It should work

     

    Please mark the question solved when done and consider giving kudos if posts are helpful.

    Contact me privately for support with any larger-scale BI needs, tutoring, etc.

    Cheers 

     

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

    Hi, rmeng 

     

    You need to use 'Text.From' function to change the date types of '[Date]', '[mdm ID]', '[User ID]' as text before the concatenation. The pbix file is attached in the end.

     

    I created data to reproduce your scenario.

    Table:

     

    Then you may create a custom column as below.

    if [Counts]="Yes" then Text.From([Date])& Text.From([mdm ID])&Text.From( [User ID]) else null

     

     

    Result:

     

    Best Regards

    Allan

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.