Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
lost_rabbit
Contributor III
Contributor III

Using dimensions to create another dimension

I have two dimensions called  'year' and 'week' that are derived from the 'Date' Field. I want to create a new dimension called 'DataYear' which is the multiplication of the dimensions 'year' and 'week'.  But I am unable to use the dimensions in the expression editor. Only the fields show up.

So does that mean I can't use dimensions I created in the app to create another dimension?

p.s I know I can create a calculated field in the load script but I do not have access to it. So is there a way to handle this?

Thanks in advance

Labels (2)
1 Solution

Accepted Solutions
agigliotti
MVP
MVP

maybe this:

Sum( if (Year(Date) = Max( total Year(Date) ), Sales ) )

Regards

The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it

View solution in original post

3 Replies
agigliotti
MVP
MVP

Hello @lost_rabbit ,

In the same way you created that two dimensions on Master items, you have to create a new calculated dimension in order to use it in any charts.

Ex. Calendar.Year & Calendar.Week

You can't use a master dimension in the chart expression editor.

Best Regards

Andrea

The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it
lost_rabbit
Contributor III
Contributor III
Author

Say for eg. I want to calculate sum(Sales) for the recent year. If I had a field 'Year' in my data, I would use a set expression like this. 

Sum({<Year = {'$(=Max(Year))'}>}Sales)


But now I do not have a Year field in my data. I only have a Date field and I created 'Year' as a dimension using the formula YEAR(DATE). How would I write my formula to calculate the sum of sales for the recent year?

I tried this, but it didn't workout

=Sum ({<[Year(DATE)]={$(=max(Year(DATE)))}>} Sales)

agigliotti
MVP
MVP

maybe this:

Sum( if (Year(Date) = Max( total Year(Date) ), Sales ) )

Regards

The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it