Forum Discussion
Is concatenate broken ?
Hi,
(First of all, sorry i don't know how to create a box for my code to make it look nicer and also english isn't my native language)
I don't know if it's a bug or if it's me not understanding how to concatenate strings or how it works but when i try this code to create a column :
loop;
//concatenate every rows in their unicode string value
When i do RETURN test1, for one of my [People] the result "SERAY A" (this case is OK)
BUT RETURN test1 &" "& test1 or CONCATENATE(test1&" ";test1), the same [People] gives me "E AASRY E AASRY" which means that suddently test1 is "E AASRY" and not "SERAY A"
Thank you for the help
Hi Maradh,
If possible, could you please inform me more detailed information (such as your sample data and your expected output)? Then I will help you more correctly.
Please do mask sensitive data before uploading.
Thanks for your understanding and support.
Best Regards,
Zoe ZhiIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Maradh,
This might be caused the temp table in your expression, so I suggest you could return test1 , then use measure like below to get result
measure=LEFT(MIN(T6[ID_data]),6) &"|"&RIGHT(MIN(T6[ID_data]),6)Or you could use M code to get upper case like below
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwtNQ31Dc0UNJR8vJ3DQ5xDFLwys9LLMlIzAMKmQKBUqwOVJ0RRJ1TkKOfi7+CS2Y+RIWJUmwsAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Date = _t, Employe = _t, ID = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Employe", type text}, {"ID", Int64.Type}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Text.ToList([Employe])), #"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom"), #"Added Custom1" = Table.AddColumn(#"Expanded Custom", "Custom.1", each if [Custom]=Text.Upper([Custom]) then [Custom] else null), #"Grouped Rows" = Table.Group(#"Added Custom1", {"Employe"}, {{"com", each Text.Combine([Custom.1]), type text}, {"all", each _, type table [Date=date, Employe=text, ID=number, Custom=text, Custom.1=text]}}), #"Expanded all" = Table.ExpandTableColumn(#"Grouped Rows", "all", {"Date", "ID"}, {"all.Date", "all.ID"}), #"Removed Duplicates" = Table.Distinct(#"Expanded all") in #"Removed Duplicates"Then use above meausre.
Best Regards,
Zoe ZhiIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 Replies
- MaradhHelper I
OK so i retry few hours later with the same code and without restarting PBI Desktop, and now it is working well but im still blocked with the same problem but with LEFT(test1; 6) and RIGHT(test1; 6)
LEFT(test1; 6) give me "SERAY" (OK)
RIGHT(test1; 6) give me "ERAY A" (OK)
But LEFT(test1;6) & " " & RIGHT(test1; 6) give me "SERAAY ERAAY" (Not OK, should be "SERAY ERAY A")- daxCommunity Support
Hi Maradh,
If possible, could you please inform me more detailed information (such as your sample data and your expected output)? Then I will help you more correctly.
Please do mask sensitive data before uploading.
Thanks for your understanding and support.
Best Regards,
Zoe ZhiIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- daxCommunity Support
Hi Maradh,
I don't know the [log_ID] in your sample, and I am not sure whether this wil cause this problem. I think you could try to check the value return from test1(you could try to return test1 in expression) or you could upload your sample(pbix) to me, then I will test this in my environment.
Best Regards,
Zoe ZhiIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- daxCommunity Support
Hi Maradh,
This might be caused the temp table in your expression, so I suggest you could return test1 , then use measure like below to get result
measure=LEFT(MIN(T6[ID_data]),6) &"|"&RIGHT(MIN(T6[ID_data]),6)Or you could use M code to get upper case like below
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwtNQ31Dc0UNJR8vJ3DQ5xDFLwys9LLMlIzAMKmQKBUqwOVJ0RRJ1TkKOfi7+CS2Y+RIWJUmwsAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Date = _t, Employe = _t, ID = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Employe", type text}, {"ID", Int64.Type}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Text.ToList([Employe])), #"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom"), #"Added Custom1" = Table.AddColumn(#"Expanded Custom", "Custom.1", each if [Custom]=Text.Upper([Custom]) then [Custom] else null), #"Grouped Rows" = Table.Group(#"Added Custom1", {"Employe"}, {{"com", each Text.Combine([Custom.1]), type text}, {"all", each _, type table [Date=date, Employe=text, ID=number, Custom=text, Custom.1=text]}}), #"Expanded all" = Table.ExpandTableColumn(#"Grouped Rows", "all", {"Date", "ID"}, {"all.Date", "all.ID"}), #"Removed Duplicates" = Table.Distinct(#"Expanded all") in #"Removed Duplicates"Then use above meausre.
Best Regards,
Zoe ZhiIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.