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

Measure at end of period

Hello

I'm trying to calculate some measures at the end of a (selected) period, and display these measures in a KPI, a graph or a table.

  • sum({$<offer={'A'},[YearMonth]={"$(=Max([YearMonth]))"}>} subscriptions) is OK in a KPI.
  • aggr (sum({$<offer={'A'}>} subscriptions), YearMonth) is OK in a graph or table with time dimension

But I'm looking for an expression working in both cases.

I've tried to use aggr() and FirstSortedValue(. But I didn't find the good expression:

  • FirstSortedValue( aggr (sum({$<offer={'A'}>} subscriptions), YearMonth), -YearMonth): KO
  • sum( aggr( FirstSortedValue(sum({$<offer={'A'}>} subscriptions),-YearMonth), YearMonth) 😞 KO

Any idea?

Regards

2 Replies
jleberre
Contributor II
Contributor II
Author

FirstSortedValue( aggr (sum({$<offer={'A'}>} subscriptions), YearMonth), -aggr (YearMonth, YearMonth)) seems to work

jleberre
Contributor II
Contributor II
Author

I see that this kind of expression does not work:

  • With operator between two sets: FirstSortedValue( aggr (sum({$<offer={'A'}>-<customer={'x'}>} subscriptions), YearMonth), -aggr (YearMonth, YearMonth)) -> KO

  • In a pivot table with another dimension than YearMonth

Could someone help me?

Thanks!