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.
Hi all,
I have 2 columns, Clients and their Totals. One client needs to have their total divided by 5.
I made a conditonal column that works, formula: = Table.AddColumn(#"Added Custom", "Custom", each if [Client] = "ABC" then [Total]/5 else [Total])
Althouugh this works, is there a way to select the Total column and do this without creating a new column?
As far as I know the this cannot be done under Transform, Standard operations because I cannot us an each if expression.
Thanks!
Solved! Go to Solution.
Hi @mindfulmike ,
Please try:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTI0VIrVATKdgGwjIyjbGcgxNlaKjQUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Clients = _t, Totals = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Clients", type text}, {"Totals", Int64.Type}}),
Custom1 = Table.FromColumns({Table.ToColumns(#"Changed Type"){0}} & {List.Transform(Table.ToRows(#"Changed Type"), each if _{0}="ABC" then _{1}/5 else _{1})},{"Clients","Totals"})
in
Custom1
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
=Table.ReplaceValue(PreviousStepName,each [Client],5,(x,y,z)=>if y="ABC" then x/z else x,{"Total"})
Hi @mindfulmike ,
Please try:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTI0VIrVATKdgGwjIyjbGcgxNlaKjQUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Clients = _t, Totals = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Clients", type text}, {"Totals", Int64.Type}}),
Custom1 = Table.FromColumns({Table.ToColumns(#"Changed Type"){0}} & {List.Transform(Table.ToRows(#"Changed Type"), each if _{0}="ABC" then _{1}/5 else _{1})},{"Clients","Totals"})
in
Custom1
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Table.SelectRows(prevStep, each ([Column1]/5 = 1))
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.