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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Joak
Frequent Visitor

Concatenate date, number and letters in power query

Hello, 

 

In power query editor, I have to concatenate three of my columns which contains dates, numbers and letters. 
It should work as the code is as simple as = [Column1]&[Column2]&[Column3] 

However I get an issue message from power Bi ntfying me that the operator cannot be applied to number and date types. 

I see that : 

'Operator=&amp'

 

However in operator I only have simple text, and no null or "&amp" rows. 

 

What does that mean ?

 

Thanks 🙂 

1 ACCEPTED SOLUTION
KHorseman
Community Champion
Community Champion

The & operator only works on text values. You'll need to use converter functions to get text values from your non-text columns.

 

= [TextColumn] & Date.ToText([DateColumn]) & Number.ToText([NumberColumn])

 

Or

 

= [TextColumn] & Text.From([DateColumn]) & Text.From([NumberColumn])





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

8 REPLIES 8
mbuick
Frequent Visitor

Hi,

 

I'm having this issue and the method below isn't working. I am trying to concatenate the following to create a unique ID;

 

Date in column (t1) as 10/31/2017 7:38:00 AM - Date/Time

Location ID in column (Location.id) as 2682 - Integer

 

Number.ToText for the location ID works but the formual returns as error when I add in Date.ToText.

 

Cheers.

KHorseman
Community Champion
Community Champion

The & operator only works on text values. You'll need to use converter functions to get text values from your non-text columns.

 

= [TextColumn] & Date.ToText([DateColumn]) & Number.ToText([NumberColumn])

 

Or

 

= [TextColumn] & Text.From([DateColumn]) & Text.From([NumberColumn])





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

@KHorseman Good solution! Smiley Happy

Anonymous
Not applicable

Hi,

 

I tried to use the function in a calcuated column in Direct Query mode. I got this error:

"Failed to resolve name 'Number.ToText'. It is not a valid table, variable, or function name."

 

Please advise.

There are a lot of query functions that are restricted in Direct Query mode. I believe that's one of them. You can't do much transformation of data in Direct Query mode, only in Import.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Thank you for the reply. Is there a workaround?

 

I wanna create a column "Bay & Level" using PickAisle, PickModule, PickBay & PickLevel.

Eg: 42B-003-3. If the value is NULL, I want it to be blank. 

I used the Number.ToText function to convert the PickAisle column to text values and combine it with PickModule. But, that didn't work in DirectQuery mode. Any help would be appreciated.

 

BayLevel.PNG

 

If you're using direct query, you should be working with a database that has all the data you need already pretty much modeled the way you need it. If there is a column like you're describing that doesn't exist I would recommend working with your DBA to adjust the source to suit your needs. If your database doesn't suit your reporting needs and can't be changed, you will probably need to use Import instead of Direct Query.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thanks it works perfectly !

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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