Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I need help on calculated dimension. I need to get max year in my calculated dimension and for that reason I have used the below expression:-
{Year=<=max(Year)>}Year
and also I need previous year as a calculated dimension:-
{Year=<=max(Year)-1>}Year
but it gives me an error.
please help me to solve this.
Thanks,
Sandip Ghosh
How can dimension get calculated for the complete set of values .
I think for this you need to first get the desired filter in your script.
I have a year field and based on that I need to calculated Maximum year
I'm not sure if you it really needed as dimension. Often set analysis within the expressions is a better approach:
https://community.qlik.com/search.jspa?q=current+vs+previous
Simply create YTD, moving totals and comparisons versus Year Ago
- Marcus
Hi Sandip,
You can try,
only(Year) & only(Year)-1
Let me know is it working or not.
Like this:
Aggr(Only({<Year={'$(=Max(Year))','$(=Max(Year)-1)'}>} Year),Year)
Calculated Dimension,
=aggr(if(Year=only(Year),Year,''),Year)
or
=aggr(if(Year=max(Year),Year,''),Year)
and along with click option Suppress When Value is Null
I have three columns like this :-
Year expense Income
2015 123 1234
2014 123 345
2013 123 345
2012 234 3345
Now I want to show Current year (Which is 2015) and previous year as a dimension and expression as sum(expense) and sum(income).
Now how to do that thing? means what I have to do in calculated dimensions.
please suggest.
We can achieve that using set analysis in a simple way.
Use:
sum({<Year = {2014,2015}>}expense) and sum({<Year = {2014,2015}>}income)
Thanks,
Singh
You don't have to use calculated dimension. You can use separate expressions
sum({$<Year={"$(=year(today()))"}>} expense)
sum({$<Year={"$(=year(today())-1)"}>} expense)
Similar for income
But if you prefer calculated dimension, it is
aggr(only({<Year={"$(='<=' & year(today()) & '<=' (year(today())-1))"}>} Year), Year)