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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Column with Power Query/ M

Hi, i have following Code:

 

Abba1234_0-1610975342264.png

But for some reason, the last Else doenst work.

 

Any ideas why?

 

Thanks!

1 ACCEPTED SOLUTION
Smauro
Solution Sage
Solution Sage

Hey @Anonymous 

 

Your issue is with Text.StartsWith . When given a null value it returns null so PBI doesn't know what to do with this logical. You have to account for null too. Try:

if [Priority] = null then null else
    if Text.StartsWith([#"Additional info:"]??"""CQN")
    or Text.StartsWith([#"Additional info:"]??"""FQN")
        then Text.BeforeDelimiter(Text.Start([#"Additional info:"], 12), ":")
    else [Priority]

 

It should do the trick.



Cheers




Spyros Mavroforos

Data Consultant


Find me on LinkedIn or drop me an email

eSpyros

View solution in original post

5 REPLIES 5
Smauro
Solution Sage
Solution Sage

Hey @Anonymous 

 

Your issue is with Text.StartsWith . When given a null value it returns null so PBI doesn't know what to do with this logical. You have to account for null too. Try:

if [Priority] = null then null else
    if Text.StartsWith([#"Additional info:"]??"""CQN")
    or Text.StartsWith([#"Additional info:"]??"""FQN")
        then Text.BeforeDelimiter(Text.Start([#"Additional info:"], 12), ":")
    else [Priority]

 

It should do the trick.



Cheers




Spyros Mavroforos

Data Consultant


Find me on LinkedIn or drop me an email

eSpyros

AlB
Community Champion
Community Champion

@Anonymous 

I need either the pbix file (or ine with dummy data thhat reproduces the error) or a complete explanation of the error messages that you get. Otherwise I cannot help.

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

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

Cheers 

 

SU18_powerbi_badge

 

 

Anonymous
Not applicable

Hi @AlB ,

 

Thank you for the help!!

 

 

Unbenannt.PNG

AlB
Community Champion
Community Champion

Hi @Anonymous 

What exactly is it that does not work? can you share the pbix?

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

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

Cheers 

 

SU18_powerbi_badge

 

Anonymous
Not applicable

Hey @AlB ,

Abba1234_0-1610996785766.png

Thats the result.

 

Abba1234_1-1610996888118.png

In the line, where DoA is, is the Error.

 

 

 

Helpful resources

Announcements
60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.