Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Mazarinen
Contributor II
Contributor II

X-axis no correct when displaying this years amount and last year same period

Hello, I am new to Qlik and would like to display this years amount and last years same period in the same graph.

But I want the time period on the x-axis to show only this year and not both like in the first picture.

Mazarinien_0-1690473238975.png

 

what I want my line chart to look like is this, but I can't get it to work, how do I get the measures to be "on top" of each other? 

Mazarinien_1-1690473379415.png

 

Br M.

 

Labels (1)
1 Solution

Accepted Solutions
cristianj23a
Partner - Creator III
Partner - Creator III

Hi, you create 2 measures by filtering the years you want to display and add those measures to the chart.

I send you some test data.

Data:
LOAD * INLINE [
YearMonth, Sales
202101, 1000
202102, 1200
202103, 900
202104, 1100
202105, 1300
202106, 950
202107, 1050
202108, 1400
202109, 1250
202110, 1600
202111, 1350
202112, 1700
202201, 1800
202202, 2000
202203, 1900
202204, 2100
202205, 2200
202206, 1950
202207, 2050
202208, 2400
202209, 2250
202210, 2600
202211, 2350
202212, 2700
];
 
 
Table:
Load YearMonth,
Right(YearMonth,2) as Month,
     Num(Right(YearMonth,2),'00') as NumMonth,
     Left(YearMonth,4) AS Year,
     Sales
Resident Data;
Drop Table Data;
 
Set analisys:
 
Max Year:
Sum({<Year= {"$(=Max(Year))"} >} Sales)
 
Min Year:
Sum({<Year= {"$(=Max(Year)-1)"} >} Sales)

 

cristianj23a_0-1690827585149.png

Regarts.

 

https://www.linkedin.com/in/cristianjorge/
Do not forget to mark as "Accepted Solution" the comment that resolves the doubt.

View solution in original post

1 Reply
cristianj23a
Partner - Creator III
Partner - Creator III

Hi, you create 2 measures by filtering the years you want to display and add those measures to the chart.

I send you some test data.

Data:
LOAD * INLINE [
YearMonth, Sales
202101, 1000
202102, 1200
202103, 900
202104, 1100
202105, 1300
202106, 950
202107, 1050
202108, 1400
202109, 1250
202110, 1600
202111, 1350
202112, 1700
202201, 1800
202202, 2000
202203, 1900
202204, 2100
202205, 2200
202206, 1950
202207, 2050
202208, 2400
202209, 2250
202210, 2600
202211, 2350
202212, 2700
];
 
 
Table:
Load YearMonth,
Right(YearMonth,2) as Month,
     Num(Right(YearMonth,2),'00') as NumMonth,
     Left(YearMonth,4) AS Year,
     Sales
Resident Data;
Drop Table Data;
 
Set analisys:
 
Max Year:
Sum({<Year= {"$(=Max(Year))"} >} Sales)
 
Min Year:
Sum({<Year= {"$(=Max(Year)-1)"} >} Sales)

 

cristianj23a_0-1690827585149.png

Regarts.

 

https://www.linkedin.com/in/cristianjorge/
Do not forget to mark as "Accepted Solution" the comment that resolves the doubt.