Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Swathi
Creator
Creator

i need to create staked bar chart , need to show sum(volume) of current year and previous year, need to show sum(sales) of current year and previous y

i need to create staked bar chart , need to show sum(volume) of current year and previous year, need to show sum(sales) of current year and previous year for customers. based on selection of cust0mer it should filter the data. i shared the sample picture how i need, Kindly help to how to do that.  it tis little urgent also

Swathi_0-1703750168382.png

 

 

 

 

Labels (3)
6 Replies
durgesh22
Creator
Creator

Hi

you can refer below,

data used "

tab:
load * Inline [
Date,Sales,Volume
1/1/2022,1000,1212
21/2/2022,550,7878
30/3/2022,4544,3576
4/4/2022,879,3434
23/4/2023,7676,1867
1/4/2023,6875,1454
30/5/2023,3422,353
12/9/2023,5666,35
23/12/2023,343434,66
];

"

durgesh22_1-1703755649005.png

 

durgesh22_0-1703755590402.png

 

Swathi
Creator
Creator
Author

@durgesh22 , i  need both 2022 and 2023 sales in one bar, both volume 2022 and 2023 in one bar, not like 2022 cm2 and volume in one bar and 2023 sales and volume in one bar help me with these

 

Swathi_0-1703756513043.png

 

vinieme12
Champion III
Champion III

As below

 

 

vinieme12_0-1703757807572.png

 

Use a Bar Chart:

Dimension

=valuelist('Sales','Volume')

Bars: 

=yearIS

 

Measure:

=if(valuelist('Sales','Volume')='Sales'
,Sum(Sales)
,if(valuelist('Sales','Volume')='Volume'
,Sum(Volume)
))

 

vinieme12_1-1703757901864.png

 

sample data

tab:
load date#(Date,'DD/MM/YYYY') as dateIS,year(date#(Date,'DD/MM/YYYY')) as yearIS,Sales,Volume Inline [
Date,Sales,Volume
1/1/2022,1000,1212
21/2/2022,550,7878
30/3/2022,4544,3576
4/4/2022,879,3434
23/4/2023,7676,1867
1/4/2023,6875,1454
30/5/2023,3422,353
12/9/2023,5666,35
23/12/2023,343434,66
];

 

 

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Swathi
Creator
Creator
Author

@vinieme12 , Kindly give above sample qvf file 

Swathi
Creator
Creator
Author

@vienueme , Thanks for the reply,

, i can able to do, still the problem is, if comparison of data, if we take previous it will all months data(jan to dec), but current year  it will not complete whole year, , it should consider like for ex current month november, it show show data, jan to nov 2023 and jan to november2022. it should take

vinieme12
Champion III
Champion III

just create a flag field in your master calendar to flag ytd months and use that in set analysis 

Example

sum{<ytd_flag={1}>} Sales)

 

there is plenty of content on the community on how to do ytd calculations, I’d suggest using the search bar on the community page 

 

if your original query is resolved then kindly close this thread 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.