Skip to main content
Announcements
Happy New Year! Cheers to another year of collaboration, connections and success.
cancel
Showing results for 
Search instead for 
Did you mean: 
Daniboy2019
Contributor II
Contributor II

Sum last inventory based on last upload date ---Ayuda-Help me

Good morning, I'm trying to get my last registered amount based on the date and product, but the registration date in a single day brings different hours and minutes, I want to get the last registration of your last hour by product.

I have managed to bring the last reading date by product, but I can't find how to bring the inventories.  

I am attaching images and the formula that I have used, I would appreciate your help.

AGGR (
IF ( Sum( inventory ) > 0,
DATE ( AGGR (
Max( read_date ),
EstacionID, Producto ), 'DD-MM-YYYY- HH:mm:ss' ) ),
EstacionID, Producto )

Labels (4)
1 Solution

Accepted Solutions
PedroNetto
Partner - Creator
Partner - Creator

Hi @Daniboy2019 

Try: FirstSortedValue( Inventory, -read_date)

Result: 

PedroNetto_0-1680723972748.png

 

View solution in original post

6 Replies
PedroNetto
Partner - Creator
Partner - Creator

Hi @Daniboy2019 

Try: FirstSortedValue( Inventory, -read_date)

Result: 

PedroNetto_0-1680723972748.png

 

BrunPierre
Partner - Master
Partner - Master

Hi, you may have to format read_date as such;

Timestamp(Timestamp#(read_date ,'DD/MM/YYYY hh:mm:ss.0'),'DD-MM-YYYY hh:mm:ss') as read_date 

Dimensions: EstacionID and Producto 

read_date: =Max(read_date)

Inventory: =FirstSortedValue(Inventory, -read_date)

Kushal_Chawda

@Daniboy2019  try below

Assuming you have Dimensions EstacionID,read_date,Producto, you can write below measure

=sum(aggr(FirstSortedValue( aggr(sum(Inventory),EstacionID,Producto,read_date),-read_date),EstacionID,Producto))

 

If you have unique value on combination of EstacionID,read_date,Producto, Inventory you can use below expression

sum(aggr(FirstSortedValue(Inventory,-read_date),EstacionID,Producto))

 

Note:  Uncheck suppress zero value option from chart properties

 

Kushal_Chawda

@Daniboy2019  try below

Assuming you have Dimensions EstacionID,read_date,Producto, you can write below measure

=sum(aggr(FirstSortedValue( aggr(sum(Inventory),EstacionID,Producto,read_date),-read_date),EstacionID,Producto))

 

If you have unique value on combination of EstacionID,read_date,Producto, Inventory you can use below expression

sum(aggr(FirstSortedValue(Inventory,-read_date),EstacionID,Producto))

 

Note:  Uncheck suppress zero value option from chart properties

 

Daniboy2019
Contributor II
Contributor II
Author

This worked for me, thanks a lot for the help 😊

Daniboy2019
Contributor II
Contributor II
Author

Thank you very much for the help 🙂 , I will try to apply this formula 🤗