cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Max date

Hello!

Sorry for my English.

 

There are SharePoint lists with devices and repair dates.

Devices:

|     ID     |     DeviceTitle     |

------------------------------
|     1       |         dev1          |
|     2       |         dev2          |
------------------------------

Repair
|      ID     |      DeviceID     |      DateOfRepair     |
----------------------------------------------------
|      1      |        1                | DateTimeValue1     |
|      2      |        1                | DateTimeValue1     |

 

I need to get a collection where the last repair date is selected for each device.

 

I take two steps:

ClearCollect( DeviceReps; GroupBy( Repair; "DeviceId"; "Attestations" ));;
ClearCollect( LastRepDate; AddColumns( DeviceReps ; "MaxDate"; Max( Repair; DateOfRepair ) ) )

 

I get a collection DeviceReps:

 

|     DeviceID     |      MaxDate       |
-------------------------------------
|       1               | 1528664400000 |
|       1               | 1550700000000 |

How to get DateTime from 1528664400000? Or another way?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Max date

@_micom_ 

Max is going to return a number.  Converting that back to a date is a challenge.

 

Here's another option to consider:

ClearCollect( LastRepDate; 
AddColumns( DeviceReps ;
"MaxDate";
First(Sort( Repair; DateOfRepair; Descending)).DateOfRepair
)
)

This will sort the dates most recent being first and then take that first value of the DateOfRepair for your Column value.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

4 REPLIES 4
Highlighted
Super User III
Super User III

Re: Max date

@_micom_ 

Max is going to return a number.  Converting that back to a date is a challenge.

 

Here's another option to consider:

ClearCollect( LastRepDate; 
AddColumns( DeviceReps ;
"MaxDate";
First(Sort( Repair; DateOfRepair; Descending)).DateOfRepair
)
)

This will sort the dates most recent being first and then take that first value of the DateOfRepair for your Column value.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

Highlighted
Regular Visitor

Re: Max date

 
 
 
 
 
 
 
 
 
 
 
 
 
 
Thank you very much. It works great for me.
Highlighted
New Member

Re: Max date

Hi Randy,

Could you please inform whether this can be used with "UI Flow (Preview)" of "Power Automate" to "Click" on the "Latest Date" in a "Website Table" or not?

 

I have a table with 8 columns and multiple rows.

In 5th column I have dates.

In 3rd column I have hyperlink.

 

Can we click on a hyperlink (2nd column) whose date is the highest (5th column)?

Highest Date.png

 

Thanks in advance.

 

Regards, 

SK

Highlighted
Frequent Visitor

Re: Max date

Thks, Simple and elegant solution.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (5,112)