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

If condition with multiple DateAdd

So I have this issue and I'm not sure if it's a PowerApp bug or something I'm doing wrong.

 

If(
DataCardValue37.Selected.Value = "APPROVED - A", DateAdd( Now(), 3, Years ),"dd-mm-yyyy",
DataCardValue37.Selected.Value = "APPROVED - B", DateAdd( Now(), 1, Years ),"dd-mm-yyyy"
)

 

I have this condition where it checks a value of a dropdown (value37) and assigns a date on the Default property of a datetime field. This syntax isn't working for me, says that it has invalid arguments. But if I do this:

 

If(
DataCardValue37.Selected.Value = "APPROVED - A", DateAdd( Now(), 3, Years ),"dd-mm-yyyy",
)

 

It works just fine alone. I tried doing these:

 

If(
DataCardValue37.Selected.Value = "APPROVED - A", Text(DateAdd( Now(), 3, Years ),"dd-mm-yyyy"),
DataCardValue37.Selected.Value = "APPROVED - B", Text(DateAdd( Now(), 1, Years ),"dd-mm-yyyy")

 

but it displays an invalid date (when I hover through the formula it shows the right year 8/31/2024, but it's display si 7/8/2026. I'm really stumped here would appreciate any help!
)

1 REPLY 1
zmansuri
Super User
Super User

If(
DataCardValue37.Selected.Value = "APPROVED - A", DateAdd( Now(), 3, Years ),"dd-mm-yyyy",

If(
DataCardValue37.Selected.Value = "APPROVED - B", DateAdd( Now(), 1, Years ),"dd-mm-yyyy"
))

---------------------------------------------------------------------------------------------------------------------------


Was I helpful? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. It will help other users to find it faster.

follow me on Twitter @zmansuri123,
connect with me on LinkedIn from Here

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (2,118)