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 Automate / Filter Query using 2 c...
Power Automate
Unanswered

Filter Query using 2 columns

(0) ShareShare
ReportReport
Posted on by 35

So I am trying to do something with PA that is somewhat difficult and I am getting stuck at more than one place. My end-goal is to create a flow that will do the following:


1- get all the items from a ledger SharePoint list.
2- only keep the items that have an outstanding balance. (the item still needs to be paid)
3- sorts the items based on the name column. 
4- somehow creates a bill in a pdf form for each of the names in the now sorted and filtered ledger list

I have tried and tried to do this using many different methods and have fallen short every time. I am now going back to the start and trying the method of "asking the pros" on here. 🙂 

My question is about the Filter Query option in the get all SharePoint items function. What I was doing before was creating an array variable, using a condition to see if the paid amount was not equal to the billed amount and if that was true it meant that there was still a balance on that item to be paid and so I appended it to the array. This worked fine but seems inefficient as the Get All function already goes through 'N' items and doing so again seems like a waste of time. My issue is that apparently I can't just say any of the following...

AmountBilled eq AmountPaid (both of these columns are currency columns and not calculated values)
AmountOutstanding ge 0 (AmountOutstanding is a calculated column so that's why this won't work)

I have not been able to figure out how to filter by comparing 2 columns in the same list. What I want/need is something like: If(AmountPaid eq AmountBilled, keep, discard) but I'm not sure how to achieve this.

Categories:
  • efialttes Profile Picture
    14,756 on at

    Hi!

    I am pessimistic you can compare two columns by means of a ODATA Filter Query. Did you considered using 'Filter array' action block, assign as its input 'Get items' output and define the coresponding condition rule?

    Hope this helps

  • MikeScott Profile Picture
    35 on at

    Yeah so when I use filter array, It tells me that the data types don't match and are string and int. This is when I compare AmountOutstanding (calculated currency column) > 0. To try to fix this I changed the 0 to '0'. This fixed the error but did not actually filter anything and the output was the full list again. Next, I tried to filter AmountPaid < AmountBilled. This time it said that it expects all of its parameters to be either integer or decimal numbers but found invalid parameter types: 'NULL'.'. I was hoping that flow would be a little more straight forward than this although it seems that even the most simple things are incredibly difficult unless you pay for a premium 3rd party addon of some type. I figured out a way to push the whole list to an excel table, then when reading it back in sort and filter it but again this is sooooo slow and completely unnecessary to me.

    I know that I can create an array variable then use an apply to each with a conditional inside that says if AmountBilled != AmountPaid then append it to the array and that works, but again very, very slowly. I'm essentially trying to avoid doing things that are O(n) over and over again to keep this flow from taking over an hour once it's done. If I do it this way, I will have done a get list, which I'm assuming is O(n), and then filtered it which is O(n), and all I have done is prepped the data to do the actual work on. Seems inefficient.

    Thanks for the help so far!

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 377

#2
11manish Profile Picture

11manish 292 Super User 2026 Season 2

#3
Henil Profile Picture

Henil 128

Last 30 days Overall leaderboard