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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
julianst24
Frequent Visitor

Help with column formatting in a relation many to many

Hi community, im in need for som help with this issue.

I have two columns (MTM and SBB), where i can have at the most 7 SBB for 1 MTM. i need the easiest way to pivot (or create a new table) where i can have the column MTM with unique values and 7 SBB columns so i can then connect that table by MTM to other tables and relate any SBB i want.

in the current table there are lot of rows containing the same MTM but different SBB so i cannot lookupvalue differents SBBs.

Can you help me? thanks in advance!

julianst24_0-1640027013248.png

 

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@julianst24 I guess this is what you are looking for, add a RANK column and then in matrix visual, put MTM on rows, Rank on column and SBB on values, and select aggregation as First or Last.

 

Rank = 
RANKX ( FILTER( ALL ( MTM ), MTM[MTM] = EARLIER ( [MTM] ) ), MTM[SBB], , ASC )

 

Follow us on LinkedIn

 

Learn about conditional formatting at Microsoft Reactor

My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

5 REPLIES 5
parry2k
Super User
Super User

@julianst24 I guess this is what you are looking for, add a RANK column and then in matrix visual, put MTM on rows, Rank on column and SBB on values, and select aggregation as First or Last.

 

Rank = 
RANKX ( FILTER( ALL ( MTM ), MTM[MTM] = EARLIER ( [MTM] ) ), MTM[SBB], , ASC )

 

Follow us on LinkedIn

 

Learn about conditional formatting at Microsoft Reactor

My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@julianst24 still not very clear but you can create table in the DAX using the following expression:

 

Unique MTM = DISTINCT ( Table[MTM] )

 

Follow us on LinkedIn

 

Learn about conditional formatting at Microsoft Reactor

My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

the thing is i would need from this

MTM SBB

1         A

2         B

1         C

this:

MTM SBB1 SBB2 SBB3

1         A        C

2         B

where each SBB is extracted from the first table

Hope this clears it out better, thx

parry2k
Super User
Super User

@julianst24 what will happen if the same MTM is for two SBB, what this new table will do? What SBB will be used when you create a unique MTM list with SBB?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

It really doesnt matter while i have a MTM column with unique values, and 7 SBB columns with all the SBBs for that MTM. Never mind if i have repeated SBBs while i mantain the uniqueness in the MTM column. thanks for answering!!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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