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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors