cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Shazarul
Frequent Visitor

Need help with "Or" function.

Spoiler
 

I've been trying to play around with the function called "Or" but I am not getting it right.

My current script is this but I have more of these ThisItem.1, ThisItem.2, ThisItem.3 that needs to be check.

  With(
    {
        DDate: DateDiff(
            Today(),
            ThisItem.FO_OUT,
            Days
        )
    },
    If(
        DDate <= 30,
        LightCoral,
        DDate <= 90,
        Yellow
    )
)

 

 Essentially, if (DDate or this or this or this) is true then light coral ,etc.

Help please

1 ACCEPTED SOLUTION

Accepted Solutions
v-xiaochen-msft
Community Support
Community Support

Hi @Shazarul ,

 

Could you tell me:

  • Do you want to use the or identifier in the If() function when you have more columns?

 

If my assumption is correct, I've made a test for your reference::

 

1\ This is my list LIST32.

v-xiaochen-msft_0-1607924846343.jpeg

 

v-xiaochen-msft_1-1607924846343.png

 

 

2\ Add a gallery control to test.

 

3\ Insert a label control into the gallery control and set its color property to:

With({DDate:DateDiff(Today(),ThisItem.FO_OUT,Days)},If(DDate<=30 Or ThisItem.'Test 1'<53 Or ThisItem.'Test 2'<34,LightCoral,DDate<=90,Yellow))

 

4\ The result is as follows:

v-xiaochen-msft_2-1607924846345.png

 

Best Regards,

Wearsky

View solution in original post

4 REPLIES 4
poweractivate
Community Champion
Community Champion

@Shazarul 

 

The Or function only returns boolean like this:

 

 

 

Set(_Var01,Or(true,false))

 

 

 

In example above, _Var01 would have the value true

 

Instead of true and false above inside the Or, you can use any formula that returns this kind of values as well inline if you want.

 

You can use like this in If statement:


 

 

Set(_Var02,If(Or(true,false),"possible","impossible"))

 

 

 

In above example, the Or will always return the true result. So in If it will always go to the first or true branch of that formula, so only "possible" is possible in the above example.

 

Makes sense?

 

Check if above helps. 

v-xiaochen-msft
Community Support
Community Support

Hi @Shazarul ,

 

Could you tell me:

  • Do you want to use the or identifier in the If() function when you have more columns?

 

If my assumption is correct, I've made a test for your reference::

 

1\ This is my list LIST32.

v-xiaochen-msft_0-1607924846343.jpeg

 

v-xiaochen-msft_1-1607924846343.png

 

 

2\ Add a gallery control to test.

 

3\ Insert a label control into the gallery control and set its color property to:

With({DDate:DateDiff(Today(),ThisItem.FO_OUT,Days)},If(DDate<=30 Or ThisItem.'Test 1'<53 Or ThisItem.'Test 2'<34,LightCoral,DDate<=90,Yellow))

 

4\ The result is as follows:

v-xiaochen-msft_2-1607924846345.png

 

Best Regards,

Wearsky

View solution in original post

Refer to the post below, unable to delete this post.

DateDiff(start_date, end_date, unit). My end_date consist of my many variables, ThisItem.FO_Out, ThisItem.KMC_Out, ThisItem.Test1, ThisItem.Test2, etc. 

How do I declare that many var within that DateDiff function.

Edit: I just saw an Or function inside that If function. What?!!!! Just like that and it works?!

Thanks a bunch!

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,451)