Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Hauglaen
Contributor II
Contributor II

FirstSortedValue on Max date

Hi

My dataset consist of a weekly report showing sales and inventory.

And I am having trouble displaying inventory for only the last week.

 

My current solution displays the latest inventory update for each ID and not only for the last week:

ALT(FirstSortedValue(Inventory,-Date),0)

 

Any suggestions? 

Thanks!

1 Solution

Accepted Solutions
Hauglaen
Contributor II
Contributor II
Author

Your expression didnt work, but it sent me on the right path.

 

The following expression worked for me:

SUM( IF( Date = MAX(TOTAL Date), Inventory, 0 ))

 

Thank you!

View solution in original post

6 Replies
agigliotti
Partner - Champion
Partner - Champion

could you explain better what are you trying to achieve?
what is your current result and what is your desired result?

Hauglaen
Contributor II
Contributor II
Author

My dataset looks like this:

IDInventoryDate 
12026.04.2020
21026.04.2020
31526.04.2020
11003.05.2020
21503.05.2020

 

And I only want to see the latest inventory update:

IDInventoryDate
11003.05.2020
21503.05.2020

 

My current solution includes 15 from ID 3 because its the latest value for the ID.

agigliotti
Partner - Champion
Partner - Champion

you case use the below expression:

sum( {< Date = {"$(=date(max(Date)))"} >}Inventory)

with Date and ID as dimensions.

Hauglaen
Contributor II
Contributor II
Author

Your expression didnt work, but it sent me on the right path.

 

The following expression worked for me:

SUM( IF( Date = MAX(TOTAL Date), Inventory, 0 ))

 

Thank you!

agigliotti
Partner - Champion
Partner - Champion

please close this thread and mark the reply as solution if applicable.

Hauglaen
Contributor II
Contributor II
Author

I tried sum( {< Date = {"$(=date(max( TOTAL Date)))"} >}Inventory)

But it just resulted in zeroes for each ID.