Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
rmeng
Helper II
Helper II

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?

 

Untitled.jpg

 

 

 

 

 

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
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:

c1.png

 

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

 

c2.png

 

Result:

c3.png

 

Best Regards

Allan

 

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

 

 

View solution in original post

2 REPLIES 2
v-alq-msft
Community Support
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:

c1.png

 

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

 

c2.png

 

Result:

c3.png

 

Best Regards

Allan

 

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

 

 

AlB
Super User
Super User

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 

 

SU18_powerbi_badge

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors