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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Delete Sharepoint Item when it doesn't exist in power BI Report

Hi,

I have a flow to create the item from power BI to sharepoint, but one issue I am facing is the item is still existing in sharepoint even it was cleared out from the power BI report, I am wondering if there is a way to create a flow that I can delete the item from sharepoint when it does not exist in Power BI.

 

Huge Thanks if there is any detail steps since I am new to power Automate~

12 REPLIES 12
lbendlin
Super User
Super User

- enumerate all items in your sharepoint list

- enumerate all items from your Power BI table (brought in via a DAX query?)

- Do an "Apply to each" inside an "Apply to each" to compare each SharePoint list item against the list of Power BI items. If they match, exit out of the inner loop to run the next outer loop.

- If the inner loop completes (meaning the SharePoint List item has not found a match)  delete the SharePoint List item and the move to the next outer loop.

Anonymous
Not applicable

Hi Ibendlin,

Thank you so much for your response!

I am wondering how can I set up that inner loop!

 

Best regard,

it will be set up for you when you select the list of Power BI items.

Anonymous
Not applicable

I might be confused, Is it like this? do I need to add anystep to do the comparison?

 

Thank you!!

2023-05-09 14_50_44-Window.png

you don't need to get the sharepoint items inside the outer loop. Do that before the loop starts.

Anonymous
Not applicable

 I moved it, I am wondering where should I put the delete item step and how will it make sure it is matching?

 

Thank you!!!

 

 

2023-05-09 15_02_11-Window.png

flip the loops around.

 

For each sharepoint item:  Compare against all Power BI items. if there is a match, exit the inner loop.  If not then at the end of the inner loop delete the sharepoint item.

Anonymous
Not applicable

Is this right?

 

Thank you!

2023-05-09 16_06_30-Window.png

Better. But now you need to insert the actual comparison part so it doesn't delete all sharepoint items - only the ones missing from Power BI.

Anonymous
Not applicable

Yes thats what I am curently missing, I tried to use filter array but it came out nothing.

your sharepoint list item must have a unique identifier. Ideally your Power BI data carries the same primary key.

 

The idea of comparing to an array is good in theory but in reality it doesn't work reliably (hence the double loop).  Sometimes you can use a trick of " string(array) contains  value" but that is not very reliable either.

Anonymous
Not applicable

I will Try!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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