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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live 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
FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.