Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm not sure if this is feasible.
I'd like to use a set analysis similar to the following one in a pivot table;
sum({$<id_year={$(=(id_year) - $(n))}>} value)
Where:
year_id is a sequential number of all month_years in the table
n is a value used in list box.
The set analysis should be used in a pivot table, with the goal to calculate for the current year_id (month_year) nth position before.
Of course such set analysis is not working, so I'm looking for a bit of light to address me in the right direction.
Thanks
Giulio
A rule for SET Analysis is simple: if you can define one condition for all rows in a table then you can use Set Analysis, otherwise it should be done by IF.
If you are using year_id as a dimension and you want to use the same for unique row expression then it should be IF-expression like:
sum( if ( id_year = $(=(id_year) - $(n)), value, 0)
But from this expression you can see that the condition can be true for $(n) = 0 only, then you can use this set anayisis:
sum( {<n={0}>} value)
Anyway, it's a theory. If you need a clear answer, you have to prepare a sample.
Nick, thanks for the answer.
I've tried with the if statement, but, as you have mentioned, works only in the situation where $(n)=0.
The logic, somehow, is simple
sum(if (id_year = id_year - n, value,0)) this should be logic.
When I choose a value of n <> 0 then I should sum the values for id_year - n
, but it seems that QV cannot handle such case.