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
Anonymous
Not applicable

Custom Column - Logic query?

Hi all,

I am looking to create a new column to show the status of various other columns condition.
 We will have three annswers in this column 
COMPLETE (will be when there is a name in the technician field PLUS a date in the completed field.)
ASSIGNED (will be when there is a name in the technician field PLUS NO date in the completed field.)
LOST ( WIll be when the word Lost appears on the Notes field)

Is this possible for one custom column?

1 ACCEPTED SOLUTION
mhossain
Solution Sage
Solution Sage

@Anonymous 

 

Very much possible, try below logic:

 

if [technician] <> null and [completed] <> null then "COMPLETE"
else
if [technician] <> null and [completed] = null then "ASSIGNED"
else
if Text.Contains("Lost", [Notes]) then "Lost"
else
""

 

Change the field names and your criteria names accordingly.

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@Anonymous , Create a new column in DAX like

New Column =
Switch(True(),
not(isblank([technician])) && not(isblank([completed])) , "COMPLETE",
not(isblank([technician])) && isblank([completed]) , "ASSIGNED",
search("Lost",[Notes],,0) >0 ,"LOST"
)

mhossain
Solution Sage
Solution Sage

@Anonymous 

 

Very much possible, try below logic:

 

if [technician] <> null and [completed] <> null then "COMPLETE"
else
if [technician] <> null and [completed] = null then "ASSIGNED"
else
if Text.Contains("Lost", [Notes]) then "Lost"
else
""

 

Change the field names and your criteria names accordingly.

Anonymous
Not applicable

So close mhossain,
But if the Notes field is null, I get this error
Expression.Error: We cannot convert the value null to type Text.
Details:
Value=
Type=[Type]

Hi @Anonymous ,

 

It can be operated by GUI and input a space.

V-lianl-msft_0-1604911097439.png

If the problem persists,Please take a screenshot to show the columns you described.

Please remove any sensitive data before uploading.

 

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

@Noblelox

Glad to know that.

On the error with Notes field "Expression.Error: We cannot convert null value to Text type.", try below

Again multiple methods to solve this, in your case for simplicity, before creating this custom column

perhaps you can try to replace these null value in the Notes field by replace method to some text value before your operation.

And then Notes field will not give this error in the custom column.

Hope above makese sense.

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.