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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
CarlsBerg999
Helper V
Helper V

Combining column and if sentence

Hi,

 

I'm trying to combine a basic column by using if sentences. However, this 

 

=[Column1] & "/" & if [Column3] = null then [Column7] else ""

However, this produces error "Token Literal expetcted". What is wrong with this simple command..? 

 

Thanks!

1 ACCEPTED SOLUTION
JirkaZ
Solution Specialist
Solution Specialist

Just use Text.Combine Text.Combine - PowerQuery M | Microsoft Docs

The formula would be like this:

Text.Combine({[Column1], if [Column3] = null then [Column7] else ""}, "/")

View solution in original post

2 REPLIES 2
AlexisOlson
Super User
Super User

All you need to do to fix this is put parentheses around the if statement so that it evaluates the expression in the order you intend.

= [Column1] & "/" & (if [Column3] = null then [Column7] else "")
JirkaZ
Solution Specialist
Solution Specialist

Just use Text.Combine Text.Combine - PowerQuery M | Microsoft Docs

The formula would be like this:

Text.Combine({[Column1], if [Column3] = null then [Column7] else ""}, "/")

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.