Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I have a variable and I want to call it in set analysis for YTD
example variable name is Var1
set analysis
sum({<DateField={">=$(=(YearStart(Max(DateField),0,4)))<=$(=YearEnd(Max(DateField),0,4))"},Year=,Month=>}$(Var1))
but its not working .
Hi Avneet,
Please attach a sample qvw.
Thanks and regards,
Arthur Fong
what does sum($(var1)) returns in a KPI?
and what does the var1 contains?
How it is defined?
var1 contains calculation like
sum((sales/weight) * xyz) / sum(xyz)
you can put your set analysis into a variable as below:
SET var1 = "{< DateField={">=$(=(YearStart(Max(DateField),0,4)))<=$(=YearEnd(Max(DateField),0,4))"},Year=,Month= >}";
and your expression become as below:
=sum( $(var1) (sales/weight) * xyz ) / sum( $(var1) xyz )
I hope it helps.
u can't do sum of sum:
I mean :
sum(sum(sales))
u use an aggr function (sum, count, avg etc) on a "dimension"
to be able to use sum on sum: project the second sum on a dimension so that u "tranform" it on a dimension.
I mean:
sum(aggr(sum(Sales),TheDimUsedInTheChart))
So, u can do :
sum({<DateField={">=$(=(YearStart(Max(DateField),0,4)))<=$(=YearEnd(Max(DateField),0,4))"},Year=,Month=>}
AGGR($(Var1),YourDim)
)