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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Transform data using P...
Power Automate
Answered

Transform data using Power Query - Custom filter

(0) ShareShare
ReportReport
Posted on by 39

Hello,

I have a large data set in our SQL server. I table that shows all quotes both live and ones that have been release. I'm working on a flow that sends emails to clients that released a quote with a link to a survey on the day they release the quote. I've got everything square apart from the senario where a client releases a quote but also has a live quote. I don't want them getting the survey if they have other quotes that are live.

 

In the below example 

Client 123 would not get an email unless they released the last quote.

Client 199 & 200 would

 

Release DateStatusClient Num
11/06/2021Released123
 Pending123
11/06/2021Released199
10/06/2021Released200

 

In excel I would create a helper column with a countifs formula and filter accordingly. How can I accomplish the same in power query? 

 

Thanks

Categories:
I have the same question (0)
  • Verified answer
    v-bofeng-msft Profile Picture
    on at

    Hi @Chris22 :

    I suggest you create a view in your database and then call the view in Power Query. I've made a test for your reference:

    1\My Database

    vbofengmsft_1-1625467181667.png

     

    2\Create a View

    create view Chris22View as
    select * 
    from dbo.Chris22Test
    Where not ClientNum in 
    (
    Select ClientNum from
    dbo.Chris22Test
    Where TheStatus = 'Pending'
    )

    vbofengmsft_2-1625467240121.png

     

    3\Call the view in Power Query

    vbofengmsft_0-1625467125391.png

     

     

    Best Regards,

    Bof

  • Chris22 Profile Picture
    39 on at

    Hi @v-bofeng-msft ,

     

    Thanks for this. This will definitly work but unfortunatly I don't have access to create the views and the person that does has a rather large amount on the backlog and as this is a one off view I was wondering if it was somthing I could do in the power query. 

     

    Thanks for your help, really aprecieted. 

    Chris

  • Verified answer
    v-bofeng-msft Profile Picture
    on at

    Hi @Chris22 :

    Sorry,I'm not formula with M language ,I spent some time to learn it:

    1\My Data source

    vbofengmsft_1-1625475573350.png

    2\Navigate to "Advanced editor"

    vbofengmsft_2-1625475612205.png

    3\Modify the code

    let
     Source = Sql.Database("XXXX", "XXXX"),
     Navigation = Source{[Schema = "dbo", Item = "Chris22Test"]}[Data],
     SelectPendingTask = Table.Column(Table.SelectRows(Navigation, each Text.Contains([TheStatus], "Pending")),"ClientNum"),
     SelectNotPendingTask = Table.SelectRows(Navigation,each not List.ContainsAny(SelectPendingTask,{[ClientNum]}))
    in
     SelectNotPendingTask

    vbofengmsft_0-1625475559516.png

    The Result:

    vbofengmsft_3-1625475662699.png

    Best Regards,

    BOf

     

     

     

  • Chris22 Profile Picture
    39 on at

    Hi BOf,

    Apologies, I completly forgot to respond to your message. This is exactly what I needed, thank you some much for your help. It was really apreciated.

    All the best

    Chris

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard