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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is 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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

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.