Forum Discussion
Anonymous
3 years agoNot applicable
undefined
Hey guys,
I need to create a column in my powerbi table (powerquery) with the following condition If "brand" column is = "PEUGEOT" AND "CITROEN" then get the position from 1 to 3 ELSE positio...
- 3 years ago
Hi Anonymous,
Do you mean something like:
Source = FatorequisicaoDetalheOr if the table/query name has spaces or special characters:
Source = #"FatoRequisicaoDetalhe"Kind regards,
John
Anonymous
3 years agoNot applicable
Claro João, sem problemas.
Coluna "Marca_Ajustada" e Coluna Chassi, A coluna que preciso, precisa pegar as 3 primeiras posições do chassis,
se a coluna "marca_ajustada" for equal a Citroen ou Peugeot,se for diferente, então tome as posições 4 a 6
- jbwtp3 years agoMemorable Member
Hola,
if I understand your idea correctly, you can do it simiar to this:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcs4sKcpPzVPSUTI0MjYxNYMwlGJ1opUCUkvTU/NLgCJgGXMIAyzlll+UAuSChS2ADBAJEg/Jr8wvSQQKgCUsgQwQGRsLAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Marca = _t, Chassi = _t, Expected = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Marca", type text}, {"Chassi", type text}, {"Expected", type text}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each if List.Contains({"CITROEN", "PEUGEOT"}, Text.Upper([ Marca])) then Text.Start([Chassi], 3) else Text.Range([Chassi], 3, 3), type text) in #"Added Custom"Cheers,
John
- Anonymous3 years agoNot applicable
John, how would I point the source to my data table.
Data Table = "FatoRequisicaoDetalhe"
And in this structure that you gave as an example I create a new table, I need to include columns in the same table "FatoRequisicaoDetalhe"- jbwtp3 years agoMemorable Member
Hi Anonymous,
Do you mean something like:
Source = FatorequisicaoDetalheOr if the table/query name has spaces or special characters:
Source = #"FatoRequisicaoDetalhe"Kind regards,
John