Forum Discussion
mwm39
2 years agoFrequent Visitor
Power BI- multiple values
Hi All, I have a table with items and specification (Length, width, Height, weight) and Carton used . Ideally items should show same specification and Carton used in all transactions. However so...
- Anonymous2 years ago
Hi mwm39 ,
You can apply the below codes in the Advanced Editor:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQwVNJRQsbhhkqxOiAJIyAHGYcbQSWMgRxkHG4MlUA2xgivUUCJWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Item = _t, L = _t, H = _t, W = _t, #"Carton Used" = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Item", Int64.Type}, {"L", Int64.Type}, {"H", Int64.Type}, {"W", Int64.Type}, {"Carton Used", type text}}), #"Added Custom1" = Table.AddColumn(#"Changed Type", "Corrected W", each if [L]=[H] and [L]=[W] and [H]=[W] then [H] else Number.Round(([L]+[H]+[W] )/3)), #"Added Custom" = Table.AddColumn(#"Added Custom1", "Corrected Carton Used", each if [L]=[H] and [L]=[W] and [H]=[W] then "W"&Number.ToText([H]) else "W"&Number.ToText(Number.Round(([L]+[H]+[W] )/3))) in #"Added Custom"Best Regards
Anonymous
2 years agoNot applicable
Hi mwm39 ,
You can apply the below codes in the Advanced Editor:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQwVNJRQsbhhkqxOiAJIyAHGYcbQSWMgRxkHG4MlUA2xgivUUCJWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Item = _t, L = _t, H = _t, W = _t, #"Carton Used" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Item", Int64.Type}, {"L", Int64.Type}, {"H", Int64.Type}, {"W", Int64.Type}, {"Carton Used", type text}}),
#"Added Custom1" = Table.AddColumn(#"Changed Type", "Corrected W", each if [L]=[H] and [L]=[W] and [H]=[W] then [H] else Number.Round(([L]+[H]+[W] )/3)),
#"Added Custom" = Table.AddColumn(#"Added Custom1", "Corrected Carton Used", each if [L]=[H] and [L]=[W] and [H]=[W] then "W"&Number.ToText([H]) else "W"&Number.ToText(Number.Round(([L]+[H]+[W] )/3)))
in
#"Added Custom"
Best Regards