Forum Discussion
fischelr01
6 years agoFrequent Visitor
Divide multiple columns by one column
I have a measure that counts the number of funnel deals per stage. Deal Count = CALCULATE(COUNT('FY, CW, CL Combined'[Stage Count])) I need to create a calculation that divides Stage-1 throu...
fischelr01
6 years agoFrequent Visitor
I'm having trouble extracting your file. Is it possible to describe your solution in this thread?
Thanks!
Nathaniel_C
6 years agoCommunity Champion
Hi fischelr01 ,
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTJSio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Prospect = _t, Evaluate = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Prospect", Int64.Type}, {"Evaluate", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each [Prospect]+[Evaluate]),
#"Renamed Columns" = Table.RenameColumns(#"Added Custom",{{"Custom", "Total"}}),
#"Added Custom1" = Table.AddColumn(#"Renamed Columns", "Custom", each Value.Divide([Prospect],[Total])),
#"Changed Type1" = Table.TransformColumnTypes(#"Added Custom1",{{"Custom", Percentage.Type}}),
#"Renamed Columns1" = Table.RenameColumns(#"Changed Type1",{{"Custom", "Pros %"}}),
#"Added Custom2" = Table.AddColumn(#"Renamed Columns1", "Evaluate %", each Value.Divide([Evaluate],[Total])),
#"Changed Type2" = Table.TransformColumnTypes(#"Added Custom2",{{"Evaluate %", Percentage.Type}}),
#"Added Custom3" = Table.AddColumn(#"Changed Type2", "Total %", each Value.Divide([Total],[Total])),
#"Changed Type3" = Table.TransformColumnTypes(#"Added Custom3",{{"Total %", Percentage.Type}, {"Pros %", type number}}),
#"Changed Type4" = Table.TransformColumnTypes(#"Changed Type3",{{"Pros %", Percentage.Type}})
in
#"Changed Type4" Here is the advanced editor in Power Query. If you go to the Home tab in Power Query, you will see it. Click on it to open, and then paste the above into it. If you do this in a new Power BI, you may have to enter a little table to see it active. Here is my table. Create this, then open the Advance Editor, copy and paste right over the code that is there. You will see the steps on the right side, and you can walk through each step to see what I did.
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel