Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Sam_Thomas
Creator
Creator

Sum values based on another distinct field for certain period

Hi

I need to create a KPI that details the total (sum) amount of land (in Acres) that we have used. 

I have 2 tables that I will need to use - Deliveries and Fields. 

I need to sum the total area of land (acres) for each field that has received a delivery. But I also need to make sure I only count each field's acres only once, as one field could have many deliveries. I also need to do this for certain periods (last 30 days, last 12 months etc.)

In plain English - the expression will need to be something like -

Sum Acres for each distinct fields that have received a Delivery, for the last X days. 

I tried the below expression and it has returned a value but I'm not sure it's correct. 

sum(If(DeliveryDate>= today()-30,aggr(sum(DISTINCT Acres),FieldID)))

I feel like the Acres and FieldID fields should be the other way round, but when I do that, the expression returns no value. 

Any help would be gratefully received. Let me know if you need any more info. 

Thanks in advance. 

Labels (1)
0 Replies