Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys,
I need to sum the values Qty considering the period, so my dataset is like this:
Product Date Qty KEY Sum Aggr1 01/12/2021 93 1|10|20|Text 0 01 01/11/2021 93 1|10|20|Text 0 01 01/08/2021 279 1|10|20|Text 465 2792 01/09/2020 93 2|10|20|Text2 0 93my sum measure is:
sum(aggr(Sum({$<[Date]={"$(='>=' & AddMonths(MonthStart(max([Date])),-11)& ' <= ' & Date(Max([Date]), 'DD/MM/YYYY'))"}>} Qty),[Key]))
my aggr measure is:
=sum(aggr(FirstSortedValue(Qty ,-aggr(max(Date),[Key])),[Key]))
This return null=FirstSortedValue({<[Date]={"$(='>=' & AddMonths(MonthStart(max([Date])),-11)& ' <= ' & Date(Max([Date]), 'DD/MM/YYYY'))"}>}Aggr(Sum({<[Date]={"$(='>=' & AddMonths(MonthStart(max([Date])),-11)& ' <= ' & Date(Max([Date]), 'DD/MM/YYYY'))"}>}Qty),[%SK_PriceCheck]),Aggr(Only({<[Date]={"$(='>=' & AddMonths(MonthStart(max([Date])),-11)& ' <= ' & Date(Max([Date]), 'DD/MM/YYYY'))"}>}[Key]), [Key]))
The expected result is
Product KEY Sum1 1|10|20|Text 4652 2|10|20|Text2 93
Please, can someone help me?
thank you