Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Mahamed_Qlik
Specialist
Specialist

Calculated dim

Dear all,

I have scenario as -

Dimension names as year

Year
2011
2012
2013
2014

But it is not static, it will increase in 2015.

I need calculated dimension as only last two year like -

New_Year
2013
2014

How do i will do that?

Kindly advise.

Regards,

mahamed

7 Replies
swuehl
MVP
MVP

You can either use a calculated dimensions

=Aggr( If(Year >= Max(TOTAL Year)-1,Year), Year)

or use a set expression in all your expressions, like

=Sum({<Year = {">=$(=Max(Year)-1)"}>} Value)

edit:

Your calculated dim could also just like

=If(Year >= $(=Max(Year))-1, Year)

of course.

sunny_talwar

May be this as your calculated dimension:

If(Match(Year, Max(TOTAL Year), Max(TOTAL Year) - 1), Year)

Clever_Anjos
Employee
Employee

Please try

=Aggr(Only({<Year={">=$(=Max(Year,2))"}>}Year),Year)

Not applicable

Hi Mahamed Khan, you can do this:

In 'Calculated dimension' put this expresion:

if(YEAR='2013' or YEAR='2014', YEAR)

of

if( year(today())-1= YEAR or year(today())-2= YEAR , YEAR) // with this example you always will see the last two years

Regards,

Agustín

Not applicable

Hi Mahamed Khan,

To get the last two years in the data you can use the dimension as :

=if(Year >= Max(Total Year)-1,Year)

Regards,

Anjali Gupta

dusasuman
Creator
Creator

Hi,

Try this code in calculated dimension.

=if(aggr(rank(Year)<=2,Year),Year)

It is working.. Make sure you do check Suppress null values on dimension tab.

Regards

Suman

dusasuman
Creator
Creator

Hi,

Try this code in calculated dimension.

=if(aggr(rank(Year)<=2,Year),Year)

It is working.. Make sure you do check Suppress null values on dimension tab.

Regards

Suman