cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Tamer66
Level: Powered On

Date operation only with day and month from sharepoint

Hello,

 

i hope anyone have an idea for my problem.

 

I have a sharepoint list with date fields date_from an date_to.

 

I want to check in powerapps if today's date is within date_from and date_to. The challenge is that I only want to check the day and month and not the year

 

Example:
date_from: 01.10
date_to: 01.03

--> But the Datefield in Sharepoint is with years

 

There are 2 problems here.

1. I only need day and month
2. As in my example, this can also be year-round

 

My example Formula:
Filter (SharePointList; date_from> = today () and date_to <= Today ())

Maybe someone has an idea how to do that

1 ACCEPTED SOLUTION

Accepted Solutions
Tamer66
Level: Powered On

Re: Date operation only with day and month from sharepoint

Hello @v-yutliu-msft ,

 

i have a little bit problem to understand and use this Formula.

 

This is what i use:

 

If(
DateValue(Text(Schonmass_von;"dd-mm"))<DateValue(Text(Schonmass_bis;"dd-mm"));

Filter(Fischliste;
Date(Year(Today());Month(Schonmass_von);Day(Schonmass_von))<=Today();
Date(Year(Today());Month(Schonmass_bis);Day(Schonmass_bis))>=Today()
);
DateValue(Text(Schonmass_von;"dd-mm"))>=DateValue(Text(Schonmass_bis;"dd-mm"));

Filter(Fischliste;
Date(Year(Today());Month(Schonmass_von);Day(Schonmass_von))<=Today();
Date(Year(Today())+1,Month(Schonmass_bis);Day(Schonmass_bis))>=Today()
)
)

 

The sharepoint Field in Datevalue "(DateValue(Text(Schonmass_von;"dd-mm"))" can not be found. 

 

I try it in a datatable and in a gallery an get the same Problem

 

what am I doing wrong

 

View solution in original post

4 REPLIES 4
Community Support Team
Community Support Team

Re: Date operation only with day and month from sharepoint

Hi @Tamer66 ,

Do you want to compare date and month not including year?

I suggest you try Text and DateValue function.

Using Text function can set the data's format and using DateValue can get the text's value.

Try this formula:

Filter(listname,DateValue(Text(date_from,"mm-dd"))>=DateValue(Text(Today(),"mm-dd")),
DateValue(Text(date_to,"mm-dd"))<=DateValue(Text(Today(),"mm-dd"))
)

Here's a doc about how to format data for your reference:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-text

 

Best regards,

Community Support Team _ Phoebe Liu

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Tamer66
Level: Powered On

Re: Date operation only with day and month from sharepoint

Hi @v-yutliu-msft 

 

thanks this works but when i have a date that is over the year, it's not working.

 

This works fine:

date_from_ 01.04

date_to: 15.07

 

This is still a Problem

date_from: 01.10

date_to: 01.02

 

i have no idea how can i fix this problem

Community Support Team
Community Support Team

Re: Date operation only with day and month from sharepoint

Hi @Tamer66 ,

Oh, I didn't think of this situation.

So I suggest you use if statement to see whether the date is over the year.

Try this formula:

If(
      DateValue(Text(date_from,"mm-dd"))<DateValue(Text(date_to,"mm-dd")),
                                                       ///from the same year
      Filter(listname,
               Date(Year(Today()),Month(date_from),Day(date_from))<=Today(),
               Date(Year(Today()),Month(date_to),Day(date_to))>=Today()
               ),
      DateValue(Text(date_from,"mm-dd"))>=DateValue(Text(date_to,"mm-dd")),
                                                    ///from different year
      Filter(listname,
               Date(Year(Today()),Month(date_from),Day(date_from))<=Today(),
               Date(Year(Today())+1,Month(date_to),Day(date_to))>=Today()
                )
     )

 

 

Best regards,

Community Support Team _ Phoebe Liu

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Tamer66
Level: Powered On

Re: Date operation only with day and month from sharepoint

Hello @v-yutliu-msft ,

 

i have a little bit problem to understand and use this Formula.

 

This is what i use:

 

If(
DateValue(Text(Schonmass_von;"dd-mm"))<DateValue(Text(Schonmass_bis;"dd-mm"));

Filter(Fischliste;
Date(Year(Today());Month(Schonmass_von);Day(Schonmass_von))<=Today();
Date(Year(Today());Month(Schonmass_bis);Day(Schonmass_bis))>=Today()
);
DateValue(Text(Schonmass_von;"dd-mm"))>=DateValue(Text(Schonmass_bis;"dd-mm"));

Filter(Fischliste;
Date(Year(Today());Month(Schonmass_von);Day(Schonmass_von))<=Today();
Date(Year(Today())+1,Month(Schonmass_bis);Day(Schonmass_bis))>=Today()
)
)

 

The sharepoint Field in Datevalue "(DateValue(Text(Schonmass_von;"dd-mm"))" can not be found. 

 

I try it in a datatable and in a gallery an get the same Problem

 

what am I doing wrong

 

View solution in original post

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,642)