web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Add/remove many:many r...
Power Apps
Unanswered

Add/remove many:many relationship via toggle button

(0) ShareShare
ReportReport
Posted on by 15

Good afternoon

 

I have the OOB table "Accounts" and a custom table "Use Case". I created a m:n relationship between these two tables (since a Use Case can be assigned to many Accounts and an Account can have many Use Cases).

 

Now I created a canvas driven app by selecting the Use Case table when creating a new PowerApp and I added the Account table too be able to filter per account. I added a toggle in the BrowseGallery. So far so good.

 

What I am now trying to achieve is the following: if I select an Account and there is a relationship between the Account and the Use case in the database, the toggle should be on. If not, it should be off. And consequently that I am able to add/remove relationships by using the toggle.

 

I am new to PowerApps and struggling a bit how to implement this. Could anyone give me a rough guidance please?

 

Thank you

Pete

I have the same question (0)
  • wtmayes Profile Picture
    33 on at

    Assuming tables Accounts and UseCases, each table will have a column that points back to the other.  Each of those columns is an embedded table of UseCases related to Accounts, or Accounts related to UseCases.

    Depending on the toggle you've put on your app, it may have a "Checked" or "Default" property.

    You will have a warning because of the M:N relationship, but this will work if the gallery is showing you Accounts toggle.checked: or toggle.default:
    CountRows(ThisItem.UseCases) >0

    Or
    (and will also work the other way from UseCases, because the relationship is mutual)
    CountRows(ThisItem.Accounts) >0

    This will return a boolean value that you can use to set your Checked or Default value.

    Hope it helps!!

  • a33ik Profile Picture
    3,306 Most Valuable Professional on at

    Hello,

    You will have to use Relate/Unrelate in canvas app in order to achieve your scenario - https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-relate-unrelate

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 505

#2
WarrenBelz Profile Picture

WarrenBelz 502 Most Valuable Professional

#3
Haque Profile Picture

Haque 324

Last 30 days Overall leaderboard