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
JNelson
Helper II
Helper II

Conditional column multiple if

Hello!

 

I have 3 columns [Job Number]; [Job Name] and [Client]. 

I need a new column [Job Info] createdbased off one (or two) of the above columns depending on the populated data.

 

Ideally, the [Job Info] column would:

Concatenate [Job Number] and [Job Name] 

but if [Job Number] = null then I just want [Job Name] returned

if both [Job Number] and [Job Name] = null I want [Client] returned

And if none of the above columns are populated, I just want null returned. 

 

Seems basic, but I can't think of how to do this!

 

TIA

1 ACCEPTED SOLUTION

@JNelson 

if [Job Number] <> null and [Job Name] <> null
then
Number.ToText([Job Number])&[Job Name]
else if [Job Number] = null and [Job Name] <> null
then
[Job Name]
else
[Client]

 

 

Mahesh0016_0-1673501780307.png

 

 

@JNelson If this post helps, please consider accept as solution to help other members find it more quickly and Appreciate your Kudos.

View solution in original post

6 REPLIES 6
JNelson
Helper II
Helper II

This works! Thank you so much

Idrissshatila
Super User
Super User

Hello @JNelson ,

 

you could add a conditional column using power query, check this link for instructions https://learn.microsoft.com/en-us/power-query/add-conditional-column

 

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

 

Follow me on Linkedin



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




Hello,

 

Thanks for your reply. I have tried using 'add conditional column' however it doesn't allow the 'and' argument. As I am trying to return the Client name if the Job Number AND Job Name are both blank on the row...

 

Thanks

Mahesh0016
Super User
Super User

@JNelson 

Mahesh0016_0-1673415391363.png

 


JOB INFO =
IF (
JOB[Job Name] <> BLANK ()
&& JOB[Job Name] <> BLANK (),
CONCATENATE ( JOB[Job Number], JOB[Job Name] ),
JOB[Client]
)

 

*Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Thanks for your reply. This looks like DAX not M code...? Don't I need M for Power Query? It's not recognising BLANK or &&.

Below is a screenshot of a sample data. The "Job Info" column is the desired outcome. 

Conditional Column.PNG

@JNelson 

if [Job Number] <> null and [Job Name] <> null
then
Number.ToText([Job Number])&[Job Name]
else if [Job Number] = null and [Job Name] <> null
then
[Job Name]
else
[Client]

 

 

Mahesh0016_0-1673501780307.png

 

 

@JNelson If this post helps, please consider accept as solution to help other members find it more quickly and Appreciate your Kudos.

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