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! Learn more

Reply
jadewind
Advocate I
Advocate I

Power BI cannot apply operator & to numbers?

I was following this article but when it comes to this part adding a new column: "YearQuarter = IF([Quarter] = 1,[Year]-1 & "4",[Year] & [Quarter]-1)" I get errors: "Expression.Error: The name 'IF' wasn't recognized. Make sure it's spelled correctly.".

 

Then I tried to change "IF" to "if" in the "Add Custom Column" it shows error "Token RightParen expected".

 

Then I tried to change the formula to "if [Quarter] = 1 then [Year]-1 & "4" else [Year] & [Quarter]-1" the formula seemed ok, but the new column shows all the values as "Error". When I click on "Error" it took me to the error details which states

Capture.JPG

I wonder why the formula in the original article doesn't work on my computer (I use Power BI August 2016 version), and how I can concatenate two numbers in Power BI?

4 REPLIES 4
jadewind
Advocate I
Advocate I

I just realized that I tried to add the formula in Query Editor while I guess I should have added them in the Data tables. They now work. But I just wonder how I can do it in Query Editor?

@jadewind



But I just wonder how I can do it in Query Editor?


You can follow steps below to add this new column in Query Editor.

 

1. In Query Editor, Add Column tab, click Add Custom Column to add a custom column.

1.PNG

2. Then enter the column name and use the formula below to create the column.

if [Quarter] = 1 then Number.ToText([Year]-1) & "4" else Number.ToText([Year]) & Number.ToText([Quarter]-1)

2.2.PNG

Following is the result.

3.PNG

Regards

@jadewind If you want to do via query editor then similar output of can be achieved by using Conditional column. So in query editor under Add Column tab add conditional column.

Thanks ankitmatira for your reply. I did try the conditional column but I can not perform the calculation. The "Output" will have to be either an entered value (text or number) or "Select a column" where I am not able to add "+1". 

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Solution Authors