hunger regnuh
09/16/2022, 1:40 PMThis
, previous, previousPeriod, next and nextPeriod… is there any way to get the value of the first period so i can use it as the divisor for subsequent periods?
So if i have a monthly report for example, i’d have 12 values, X1-12, then i want to calculate a value from it, so in january, it’ll be X1/X1, then February X2/X1… X12/X1hunger regnuh
09/16/2022, 2:36 PMJakub Sterba
09/16/2022, 2:48 PMselect {metric/x}/(select {metric/x} by all other where {label/date.month}="2022-01")
the first value is however not determined dynamically. The inner select will compute value of X for January and will use the same value for each month as denominator of the division.
The next release will deliver improvement. After this release you should be able to use following MAQL statement:
select {metric/x}/
(select {metric/x}
by all other
where {label/date.month}=
(select min( {label/date.month}, {dataset/facts}))
)
The select min( {label/date.month}, {dataset/facts})
will find the first month in the Facts dataset (the slicing by month will be not applied because it is used to filter metric with BY ALL OTHER).
You can test the second formula on gooddata/gooddata-cn-ce:dev_latest
already.
We are considering to introduce function FIRST_VALUE which would simplify the formula a bit.hunger regnuh
09/16/2022, 3:04 PMhunger regnuh
09/16/2022, 3:05 PM