Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
ananyaghosh
Creator III
Creator III

Need help on calculated dimensions

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

21 Replies
tyagishaila
Specialist
Specialist

Go for this attachment,

Hope it will help.

ananyaghosh
Creator III
Creator III
Author

Hi,

I have added My Excel sheet as a data and I need to use year as dimension and

sum(Average Expense Growth Rate) as expression and need to show latest two year data. So year will show as 2014 and 2014 as dimension and sum(Average Expense Growth Rate) as expression.

How to do that? Please suggest.

ananyaghosh
Creator III
Creator III
Author

If I use you dimension use is:-

Aggr(Only({<Year={'$(=Max(Year))','$(=Max(Year)-1)'}>} Year),Year)

in calculated dimension it is showing only 2014 in my bar graph.

I am attaching my excel sheet. Please use a bar graph.

ananyaghosh
Creator III
Creator III
Author

I Want to use a bar graph, so what will be the dimension and expression? as I want use year as dimension and expression as sum(expense) and sum(income)

Not applicable

Dear Sandeep,

Use the below code in your expression

({<Year={$(=max(Year)),$(=max(Year,2))}>}[Average Expense Growth Rate])

and Year as your dimension.

Thanks

Anonymous
Not applicable

Sorry Sandip, I don't see any relations between the file you uploaded and the question you asked.  There is no Year (or any date field), Income, Expense.

Are you sure you've uploaded the right file?

ananyaghosh
Creator III
Creator III
Author

Hi,

I need to create a bar graph and have to use year as dimension, but need to largest two year in dimension and have to use summation of Income and Expense as expression.

Please suggest what to do in dimension and expression?

thanks,

Sandip

Anonymous
Not applicable

Better...

See attached.  the first version is using calculated dimension.  the second - set analysis in expressions.

ananyaghosh
Creator III
Creator III
Author

Hi,

My excel holds the year value from 2015 to 2011 and your dimension expression is based on current year. But if my excel holds the maximum year as 2014 or 2013 as maximum year value, then how can I pick the maximum value from my excel sheet?

Please help me out.

ananyaghosh
Creator III
Creator III
Author

Hi,

I have used your expression, but when I select a year from a list box , for exp: 2013, in the chart it just showing the year 2013.

But If I want to show 2013, 2012 and 2011 as year dimension in the chart when I have selected the year 2013, what I have to do in the expression?