Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Delete value if not used in another list

(0) ShareShare
ReportReport
Posted on by 129

Hello,

 

I want to delete some value if I don't used them in other list, to put it simply, I have 2 list, one has a text column where I enter my data and the other list with a lookup column where I can use the data I enter previously.

 

For exemple, if I create a data named "Day"  don't use it If I create a data item called "Day" and I don't use it, I must be able to delete it and if I do use it, I must not be able to delete it.

 

I hope to be clear in my explanation,

Thanks in advance!

Categories:
  • CU22100725-0 Profile Picture
    129 on at
    Re: Delete value if not used in another list

    Hi @BCBuizer,

     

    It works perfectly now, thanks for your help !

  • Verified answer
    BCBuizer Profile Picture
    22,027 Super User 2025 Season 1 on at
    Re: Delete value if not used in another list

    Hi @TomVictor ,

     

    I think I was able to replicate the issue in my tests. Can you please try:

     

    Filter(
     'CRM - Paramètre Unité' As ParentList;
     Not(ParentList.Unité in AddColumns('CRM - Lignes commandes'; "vUnite"; Unite.Value).vUnite)
    )

     

  • CU22100725-0 Profile Picture
    129 on at
    Re: Delete value if not used in another list

    Hi @BCBuizer,

     

    I try and it still not working, "Impossible to convert this type of data", that's what my PowerApps said.

    May be it's a problem with my ParentList ?

  • BCBuizer Profile Picture
    22,027 Super User 2025 Season 1 on at
    Re: Delete value if not used in another list

    Hi @TomVictor ,

     

    It seems that the in operator does not like working with complex types. Can you please try this:

     

    Filter(
     'CRM - Paramètre Unité';
     Not('CRM - Paramètre Unité'. Unité in AddColumns('CRM - Lignes commandes'; "vUnite"; Unite.Value).vUnite)
    )

    Basically it adds a column to the ChildList with the value of the LookUp column as plain text. This can then be used to filter the ParentList.

  • CU22100725-0 Profile Picture
    129 on at
    Re: Delete value if not used in another list

    Hi @BCBuizer ,

     

    I replace ParentList, ParentColumnName, ChildList and ChildColumn name with their actual name like this :

    Filter(
     'CRM - Paramètre Unité';
     Not(Unité in 'CRM - Lignes commandes'.Unite.Value))

     

    I don't see where is my mistake.

     

  • BCBuizer Profile Picture
    22,027 Super User 2025 Season 1 on at
    Re: Delete value if not used in another list

    Hi @TomVictor ,

     

    Did you replace ParentList, ParentColumnName, ChildList and ChildColumn name with their actual names?

     

    For clarification on what I'm referring to:

     

    ParentList: The list with the Text type column in it

    ParentColumnName: the Text type column

    ChildList: The list with the LookUp type column in it

    ChildColumnName: The LookUp column

  • CU22100725-0 Profile Picture
    129 on at
    Re: Delete value if not used in another list

    Hi @BCBuizer ,

     

    Thanks for your reply, I have a problem with your first formula, It tells me "Value is not recognised". 


    How can I fix it ?

  • BCBuizer Profile Picture
    22,027 Super User 2025 Season 1 on at
    Re: Delete value if not used in another list

    Hi @TomVictor ,

     

    To do this in Power Apps, let's call the list with the values the ParentList and the list with the LookUps the ChildList.

     

    Insert a gallery in Power Apps and set its' Items property to:

    Filter(
     ParentList,
     Not(ParentColumnName in ChildList.ChildColumnName.Value)
    )

    This will display all items in ParentList that don't have a match in ParentColumnName in ChildList.ChildColumnName (which is the LookUp column).

     

    This formula will give you a delegation warning, but as long as you don't have more than 2000 items in ParentList, this is not an issue.

     

    Finally you can choose to add a remove button inside the gallery to be able to delete individual items (OnSelect = Remove(ParentList, ThisItem) ) and/or add a button outside the gallery to remove all items (OnSelect = RemoveIf(ParentList, ID in GalleryName.AllItems.ID) ).

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,651 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard