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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
jashandeepkaur
New Member

add a new column in power query to combine year and quarter

jashandeepkaur_0-1692827614462.png

Hi everyone, i am trying to create a new column in PQ to combine year and quarter. 

i tried the below formula but it is giving me error. 

Year/Qtr = [Year] & "-" & [Quarter]

 

can you please help. 

 

jashandeepkaur_2-1692827833467.png

i got my year and quarter from the notified column. i used data tab to extract year, month and quarter. but now i cannot combine them. 

1 ACCEPTED SOLUTION
v-xinruzhu-msft
Community Support
Community Support

Hi @jashandeepkaur 

You can add a custom column, then try the following code

Text.From([Year])&"-"&Text.From([Quarter])

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
mussaenda
Super User
Super User

Hi @jashandeepkaur ,

 

In Power Query, you cannot simply combine number and text data types.

Year and Quarter are number data type and "-" is text data type.

 

Here is one way of solving your issue. You will treat your numbers as text then you can concatenate them.

Year/Qtr = Number.ToText([Year]) & "-" & Number.ToText([Quarter])

 

JoeBarry
Solution Sage
Solution Sage

Hi @jashandeepkaur 

 

Along with the answer from @v-xinruzhu-msft you can use the Merge Columns feature in the Transformation Tab. 

 

First Highlight the Year Column then the Quarter Column and press the Merge Column button. You will be prompted to enter a separator and a column name

 

Thanks

Joe

 

If this post helps, then please Accept it as the solution 

v-xinruzhu-msft
Community Support
Community Support

Hi @jashandeepkaur 

You can add a custom column, then try the following code

Text.From([Year])&"-"&Text.From([Quarter])

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors