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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

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
Fabric Data Days is here Carousel

Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

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.