Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
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
position from 4 to 6.
Thanks
Solved! Go to Solution.
Hi @Anonymous,
Do you mean something like:
Source = FatorequisicaoDetalheOr if the table/query name has spaces or special characters:
Source = #"FatoRequisicaoDetalhe"Kind regards,
John
tks John
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
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
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"
Hi @Anonymous,
Do you mean something like:
Source = FatorequisicaoDetalheOr if the table/query name has spaces or special characters:
Source = #"FatoRequisicaoDetalhe"Kind regards,
John
Hi @Anonymous,
This can be done through the AddColumn menu in PBI Power Query Editor.
This is not clear, however, what do you mean by "get the position from 1 to 3"?
Cheers,
John
I have a field called Chassis, in position 1 to 3 I can identify the Peugeot and Citroen models, in position 4 to 6 I have the other manufacturers, I could do this separately, but I would need to duplicate the field and apply this rule , the question is can I do this only once, with one condition?
Hi @Anonymous,
Do you mind visualising what you are saying with a couple of screenshots or tables, so it was clear where do you start and what are you trying to achieve?
Thanks,
John
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.