cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Using a column (Embedded with formulas) as a condition in the Filter Array action

As of now, I'm looking into using a column that is embedded with a formula as a condition in the "Filter Array" action. I can't seem to use the number from that column directly as a condition because it was embedded with a formula. Below is the screenshot of the data from an excel sheet:

 

DelDev_1-1718633957937.png

 

I wanted to use [Days2] as my condition in the "Filter Array" action for if [Days2] is > 8, then do something. Below is the screenshot of the formula embedded into the [Days2] column:

DelDev_2-1718634427292.png

This formula is embedded into the [Days2] column and is preventing me to use the value, e.g. 16 as a condition in the "Filter Array" action. Any techniques or methods are appreciated, thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Del-Dev ,

 

I mean filter based on the same condition in Filter array:

vjefferni_0-1718780304125.png

vjefferni_1-1718780375716.png

@greater(if(less(item()['Date'], utcNow('yyyy-MM-dd')), dateDifference(item()['Date'], utcNow('yyyy-MM-dd')), dateDifference(utcNow('yyyy-MM-dd'), item()['Date'])), 😎

 

Best regards,

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

26 REPLIES 26
v-jefferni
Community Support
Community Support

Hi @Del-Dev ,

 

Excel formulas is not supported in Power Automate. You must calculate the value in Filter array directly using the expressions.

 

Best regards,

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

Hi @v-jefferni,

Just to make sure I'm not making any misunderstandings. I'm looking into how to make [Days2] into a condition for if [Days2] is > 8, then do something. Since the first column under [Days2] has a value of 16, it satisfies the condition and then moves on to do something. But there is an expression applied into the columns of [Days2] and is preventing me to use it as a condition in the "Filter Array" action. Therefore, I need some advice for this.

 

You mentioned that I would need to calculate the value in my flow directly using the expressions, may I ask how would I go about it? Thanks!

Hi @Del-Dev ,

 

I mean filter based on the same condition in Filter array:

vjefferni_0-1718780304125.png

vjefferni_1-1718780375716.png

@greater(if(less(item()['Date'], utcNow('yyyy-MM-dd')), dateDifference(item()['Date'], utcNow('yyyy-MM-dd')), dateDifference(utcNow('yyyy-MM-dd'), item()['Date'])), 😎

 

Best regards,

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

Hi @v-jefferni,

According to the screenshot of the expression in the first post of this discussion where the [Days2] column is embedded with the following expression:

DelDev_0-1719822322064.png

 

Now the [Days2] column is embedded with this new expression: =@IFS(@P:P="Danger", "Completed", P:P="Risky", "Completed", TODAY()-@Q:Q,TODAY()-@Q:Q>=0,TODAY()-@Q:Q). Same as usual, because the [Days2] column is embedded with such expression, I cannot get the value from the [Days2] column directly when comparing it with a condition in my "Filter Array" action, for if [Days2] is > 8.

 

I have used the above expression that you have suggested: greater(if(less(item()['Date'], utcNow('yyyy-MM-dd')), dateDifference(item()['Date'], utcNow('yyyy-MM-dd')), dateDifference(utcNow('yyyy-MM-dd'), item()['Date'])). I have set the DateTime Format in "List Rows Present in a Table" to ISO 8601 and just that I have changed the [Date] to [Outstanding Date] in my excel column and this is my current expression in my "Filter Array" action with reference to the expression of what you have suggested:

DelDev_1-1719823202716.png

 but I have encountered the error message above. I have encountered this error: 

DelDev_0-1719820864547.png

Does the word "Completed" in this expression: "=@IFS(@P:P="Danger", "Completed", P:P="Risky", "Completed", TODAY()-@Q:Q,TODAY()-@Q:Q>=0,TODAY()-@Q:Q)" play a part in the error or did I miss anything in my expression in my "Filter Array" action?

 

Hi @Del-Dev ,

 

The error is saying that a field of 'outstanding date' was "Completed", which is not an ISO 8601 format date. All the values of a single column should have the same format, either date or string.

 

Best regards,

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

Hi @v-jefferni,

Ahhhh I seeee! Thanks for the explanation for the error message! I found out that the [Outstanding Date] column of the excel sheet has 2 types of data: Date and the word "Completed". As seen from the [Days2] column embedded with this formula: "=@IFS(@P:P="Danger", "Completed", P:P="Risky", "Completed", TODAY()-@Q:Q,TODAY()-@Q:Q>=0,TODAY()-@Q:Q)", Q:Q is denoted as the data from the [Outstanding Date] and whatever data in the [Outstanding Date] would influence the data in the [Days2] column.

 

Since the [Outstanding Date] has 2 types of data: Date and "Completed", how do I go about in such a way that I  want calculate the number of days from the [Days2] column from this expression "=@IFS(@P:P="Danger", "Completed", P:P="Risky", "Completed", TODAY()-@Q:Q,TODAY()-@Q:Q>=0,TODAY()-@Q:Q) and if there is a word "Completed" in the [Outstanding Date] column, then no need calculate the number of days in the [Days2] column?

Hi @Del-Dev ,

 

I think you'd better clear the logic first. You have two types of data in Days2 column as well. What formula do you have in Outstanding Date and Days2 columns exactly? 

 

Best regards,

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

Hi @v-jefferni,

Sorry for the confusion! The data in the excel sheet previously was not updated. The below screenshot is the latest data in an excel sheet:

DelDev_2-1719904012088.png

 

 

The formulas for [Outstanding Date] and [Days2] are as follows:

 

Formula for [Outstanding Date]: =@IFS(@E:E="Danger", "Completed",@E:E="Risky","Completed",@B:B="Red1",@A:A+5,@B:B="Red2",@A:A+10,@B:B="Red3",@A:A+15,@B:B="Red4",@A:A+20,@B:B="Red5","Red5 (Keep In View)")

 

Formula for [Days2]: =@IFS(@E:E="Danger", "Completed",@E:E="Risky", "Completed",@C:C="Red5 (Keep In View)","Red5 (Keep In View)",TODAY()-@C:C<0,TODAY()-@C:C,TODAY()-@C:C>=0,TODAY()-@C:C)

 

Same as usual, because the [Days2] and the [Outstanding Date] column are embedded with formulas, I cannot get the value from the [Days2] column directly when comparing it with a condition in my "Filter Array" action, for if [Days2] is > 8.

 

With the formulas embedded in the [Outstanding Date] and [Days2] columns, how do I get the value from the [Days2] column when comparing it with a condition in my "Filter Array" action, for if [Days2] is > 8. Thanks!

 

 

Hi @Del-Dev ,

 

I understood. So, actually the logic would be:

If Status = Danger or Risky, or Level = Red5, ignore, otherwise filter items that Days are larger than 8. 

 

So, the expression in Filter array would be:

 

@and(and(not(equals(item()?['Status'],'Danger')),not(equals(item()?['Status'],'Risky')),not(equals(item()?['Level'],'Red5'))), greater(if(less(item()['Days2'], utcNow('yyyy-MM-dd')), dateDifference(item()['Days2'], utcNow('yyyy-MM-dd')), dateDifference(utcNow('yyyy-MM-dd'), item()['Days2'])), 8))

 

 

Best regards,

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

Hi @v-jefferni,

Thank you for your suggestion! So, the expression for the Filter Array that you have suggested could mitigate the error due to the word "Completed" in the previous post?

Hi @Del-Dev ,

 

It will completely ignore the Completed issue, rows that Days2 column are not a number will not be included when checking the larger than 8 condition.

 

Best regards,

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

Hi @v-jefferni,

Oh I see! After running the above expression, I have encountered the following error:

 

The execution of template action 'Filter_array' failed: The evaluation of 'query' action 'where' expression '@and(and(not(equals(item()?['Status'],'Danger')),not(equals(item()?['Status'],'Risky')),not(equals(item()?['Level'],'Red5'))), greater(if(less(item()['Days2'], utcNow('yyyy-MM-dd')), dateDifference(item()['Days2'], utcNow('yyyy-MM-dd')), dateDifference(utcNow('yyyy-MM-dd'), item()['Days2'])), 8))' failed: 'In function 'dateDifference', the value provided for date time string '-6' was not valid. The datetime string must match ISO 8601 format.'.

 

The error mentioned that the datetime string '-6' does not match with the ISO 8601 format. I do have a -6 in my ['Days2'] column and it represents the number of days. Shouldn't all the negative numbers be ignored since the condition stated that ['Days2'] is > 8? I'm wondering after the calculation of the dateDifference function, should the number of days be in ISO 8601 format and that's why this error is generated? Please advise me on this!

 

Hi @Del-Dev ,

 

Sorry, I forgot to calculate the Days2 column value in the expression. Please try below instead:

@and(and(not(equals(item()?['Status'],'Danger')),not(equals(item()?['Status'],'Risky')),not(equals(item()?['Level'],'Red5'))), greater(if(less(addDays(item()['Date of Discover'],if(equals(item()['Level'], 'Red1'),5,if(equals(item()['Level'], 'Red2'),10,if(equals(item()['Level'], 'Red3'),15,if(equals(item()['Level'], 'Red4'),20,if(equals(item()['Level'], 'Red5'),25))))), utcNow('yyyy-MM-dd')), dateDifference(addDays(item()['Date of Discover'],if(equals(item()['Level'], 'Red1'),5,if(equals(item()['Level'], 'Red2'),10,if(equals(item()['Level'], 'Red3'),15,if(equals(item()['Level'], 'Red4'),20,if(equals(item()['Level'], 'Red5'),25))))), utcNow('yyyy-MM-dd')), dateDifference(utcNow('yyyy-MM-dd'), addDays(item()['Date of Discover'],if(equals(item()['Level'], 'Red1'),5,if(equals(item()['Level'], 'Red2'),10,if(equals(item()['Level'], 'Red3'),15,if(equals(item()['Level'], 'Red4'),20,if(equals(item()['Level'], 'Red5'),25))))))), 8))

 

Best regards,

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

Hi @v-jefferni,

Woahhhh that's very long hahahah. I put the formulas for the ['Outstanding Date'] and ['Days2'] here for easy reference:

 

Formula for [Outstanding Date]: =@IFS(@E:E="Danger", "Completed",@E:E="Risky","Completed",@B:B="Red1",@A:A+5,@B:B="Red2",@A:A+10,@B:B="Red3",@A:A+15,@B:B="Red4",@A:A+20,@B:B="Red5","Red5 (Keep In View)")

 

Formula for [Days2]: =@IFS(@E:E="Danger", "Completed",@E:E="Risky", "Completed",@C:C="Red5 (Keep In View)","Red5 (Keep In View)",TODAY()-@C:C<0,TODAY()-@C:C,TODAY()-@C:C>=0,TODAY()-@C:C)

 

Based on your suggested expression on the part: if(equals(item()['Level'], 'Red5'),25. I would like to clarify with you that should that be if(equals(item()['Level'], 'Red5', 'Red5 (Keep In View)', based on the Formula for ['Outstanding Date']?

 

Based on the screenshot of the excel table in the previous post, I put it here for easy reference:

DelDev_0-1719976964862.png

 

Since C:C is denoted as ['Outstanding Date'], should ['Outstanding Date'] be in the dateDifference function instead of ['Date of Discover']?

 

In addition, I know it would be a bit tedious, would you mind explaining the thought process of your suggested expression? I just want to make sure that I understands it and correct me if I'm wrong. Thanks a lot!

 

 

 

Hi @Del-Dev ,

 

Since values of the Outstand Date column are calculated from other 3 columns, I didn't use these values but calculated the values instead, which makes the expression so long.

 

Explanation to the expression:

 

@and(
    and(
        not(equals(item()?['Status'],'Danger')),
        not(equals(item()?['Status'],'Risky')),
        not(equals(item()?['Level'],'Red5'))
    ), //ignore rows that status = danger or risky, and level = red5, because all thess rows will make Outstanding date column not a date.
    greater(
        if(
            less(
                addDays(
                    item()['Date of Discover'],
                    if(equals(item()['Level'], 'Red1'),5,if(equals(item()['Level'], 'Red2'),10,if(equals(item()['Level'], 'Red3'),15,if(equals(item()['Level'], 'Red4'),20)))  //the Outstanding Date column values, add different number of days to Date of Discover column based on Level column
                ),
                utcNow('yyyy-MM-dd')
            ),  //check the date if is earlier than today
            dateDifference(
                addDays(
                    item()['Date of Discover'],
                    if(equals(item()['Level'], 'Red1'),5,if(equals(item()['Level'], 'Red2'),10,if(equals(item()['Level'], 'Red3'),15,if(equals(item()['Level'], 'Red4'),20)))
                ), 
                utcNow('yyyy-MM-dd')
            ),  //if yes, today - calculated date 
            dateDifference(
                utcNow('yyyy-MM-dd'), 
                addDays(
                    item()['Date of Discover'],
                    if(equals(item()['Level'], 'Red1'),5,if(equals(item()['Level'], 'Red2'),10,if(equals(item()['Level'], 'Red3'),15,if(equals(item()['Level'], 'Red4'),20)))
                )
            )   //if no, calculated date - today
        ),  // the Days2 column value
        8   //if the difference is larger than 8
    )
)

 

 

Best regards,

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

Hi @v-jefferni,

 

This is my expression with reference to your suggested expression:

and(
    and(
        not(equals(item()?['Status'],'Danger')),
        not(equals(item()?['Status'],'Risky')),
        not(equals(item()?['Level'],'Red5'))
    ), 
    greater(
        if(
            less(
                addDays(
                    item()?['Date of Discover'],
                    if(equals(item()?['Level'], 'Red1'),5,if(equals(item()?['Level'], 'Red2'),10,if(equals(item()?['Level'], 'Red3'),15,if(equals(item()?['Level'], 'Red4'),20)))  
                ),
                utcNow('yyyy-MM-dd')
            ),  
            dateDifference(
                addDays(
                    item()?['Date of Discover'],
                    if(equals(item()?['Level'], 'Red1'),5,if(equals(item()?['Level'], 'Red2'),10,if(equals(item()?['Level'], 'Red3'),15,if(equals(item()?['Level'], 'Red4'),20)))
                ), 
                utcNow('yyyy-MM-dd')
            ), 
            dateDifference(
                utcNow('yyyy-MM-dd'), 
                addDays(
                    item()?['Date of Discover'],
                    if(equals(item()?['Level'], 'Red1'),5,if(equals(item()?['Level'], 'Red2'),10,if(equals(item()?['Level'], 'Red3'),15,if(equals(item()?['Level'], 'Red4'),20)))
                )
            )   
        ),  
        8  
    )
)

 

I have included a "?" between the word item() and ['Column'] to some of the lines that doesn't have. I went to save my flow and I have this error:

DelDev_0-1719997382754.png

 

Did I miss any syntax and is there any lines that I have typed wrongly?

Hi @v-jefferni,

I tried troubleshooting and looking for any syntax errors present in the code above but still cannot find any. I'm not sure where I went wrong and really need your help on this. Thanks!

Hi @Del-Dev ,

 

The if function requires 3 arguments, but I confused it with the If function in PowerApps. Try below again, please. Sorry for the carelessness...

and(
    and(
        not(equals(item()?['Status'],'Danger')),
        not(equals(item()?['Status'],'Risky')),
        not(equals(item()?['Level'],'Red5'))
    ), 
    greater(
        if(
            less(
                addDays(
                    item()?['Date of Discover'],
                    if(equals(item()?['Level'], 'Red1'),5,if(equals(item()?['Level'], 'Red2'),10,if(equals(item()?['Level'], 'Red3'),15,if(equals(item()?['Level'], 'Red4'),20,0)))  
                ),
                utcNow('yyyy-MM-dd')
            ),  
            dateDifference(
                addDays(
                    item()?['Date of Discover'],
                    if(equals(item()?['Level'], 'Red1'),5,if(equals(item()?['Level'], 'Red2'),10,if(equals(item()?['Level'], 'Red3'),15,if(equals(item()?['Level'], 'Red4'),20,0)))
                ), 
                utcNow('yyyy-MM-dd')
            ), 
            dateDifference(
                utcNow('yyyy-MM-dd'), 
                addDays(
                    item()?['Date of Discover'],
                    if(equals(item()?['Level'], 'Red1'),5,if(equals(item()?['Level'], 'Red2'),10,if(equals(item()?['Level'], 'Red3'),15,if(equals(item()?['Level'], 'Red4'),20,0)))
                )
            )   
        ),  
        8  
    )
)

 

Best regards,

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

Hi @v-jefferni,

Thanks for the reply! I noticed that in the 'addDays' function, you have added a 0 beside 20. What is the intended purpose for the 0?

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!    This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24  17 @Anil_g  7 @ManishSolanki  13 @eetuRobo  5 @David_MA  10 @VishnuReddy1997  5 @SpongYe  9JhonatanOB19932 (tie) @Nived_Nambiar  8 @maltie  2 (tie)   @PA-Noob  2 (tie)   @LukeMcG  2 (tie)   @tgut03  2 (tie)       Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate  @Deenuji  12@ManishSolanki 19 @Anil_g  10 @NathanAlvares24  17 @VishnuReddy1997  6 @Expiscornovus  10 @Tjan  5 @Nived_Nambiar  10 @eetuRobo  3 @SudeepGhatakNZ 8     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22   Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2   Anil_g2   SharonS2  

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (1,167)