Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hello everybody,
I have a table with values (revenue, margin, ...) and want to split the rows depending on the values (share%) of another table. Should I build a new table, or split the rows in the same table or working with measures? I have no idea and appreciate a lot any suggestions.
Thanks a lot
Steve
Thank you, I will try it the next day, though I don't understand this concept 😉 will give feedback!
if you did not mind the floating difference, then try this code
=#table({"Month","City","Revenue","Margin"},List.TransformMany(Table.ToRows(Table1),each Table.ToRows(Table2),(x,y)=>{x{0},y{0},x{1}*y{1},x{2}*y{1}}))
otherwise, try this
=let a=Table.ToRows(Table2),b=List.Count(a)-1 in #table({"Month","City","Revenue","Margin"},List.TransformMany(Table.ToRows(Table1),each List.Accumulate(List.Positions(a),{{},_{1},_{2}},(x,y)=>if y=b then {x{0}&{{_{0},a{y}{0},x{1},x{2}}}} else {x{0}&{{_{0},a{y}{0},_{1}*a{y}{1},_{2}*a{y}{1}}},x{1}-_{1}*a{y}{1},x{2}-_{2}*a{y}{1}}),(x,y)=>y{0}))