Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
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.
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.
Solved! Go to Solution.
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.
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])
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
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.
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
69 | |
61 | |
18 | |
16 | |
13 |