Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 10 | |
| 9 | |
| 8 | |
| 7 |