Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
gehe_muc
Frequent Visitor

Split rows in news rows with a new dimension depending from values in another table

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


SplitRowsWithShare.jpg

2 REPLIES 2
gehe_muc
Frequent Visitor

Thank you, I will try it the next day, though I don't understand this concept 😉 will give feedback!

wdx223_Daniel
Super User
Super User

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}))

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors