Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
aresb
Creator
Creator

How to insert YEAR into a table with YoY Calculation?

Hi everyone,

i'm stucked with a set expression problem.

I've created two measures, let's call them SelectedYearMeasure and PreviousYearMeasure, that i've correctly replicated in my model.

I'm working on the year column of my mastercalendar table.

The problem is that, if I try to add Year as a column in my table, i get a doubled row, one for the year selected and one for the previous year.

Qlik_Year.pngIs there any possibility to avoid this behaviour, just having selected year row?

 

Thanks.

Labels (1)
1 Solution

Accepted Solutions
stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @aresb 

There are two approaches that you might want to take.

One is to have the Year as a measure rather than a dimension. You can create it like this:

=max(Year)

The other approach, and I would probably tend towards this, is rather than having a new column with the year in, use the fact that you can have a dynamic column header to stamp the year.  In the Label of the measure have something like ='Sales ' & max(Year) and for the other ='Sales ' & (max(Year)-1).

Hope that helps.

Steve

View solution in original post

1 Reply
stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @aresb 

There are two approaches that you might want to take.

One is to have the Year as a measure rather than a dimension. You can create it like this:

=max(Year)

The other approach, and I would probably tend towards this, is rather than having a new column with the year in, use the fact that you can have a dynamic column header to stamp the year.  In the Label of the measure have something like ='Sales ' & max(Year) and for the other ='Sales ' & (max(Year)-1).

Hope that helps.

Steve