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: 
danosoft
Specialist
Specialist

Bar Chart with columns table

Hi i am in this situation:  i have a table with those columns:

gen_consumo_mensile,feb_consumo_mensile, mar_consumo_mensile,apr_consumo_mensile,mag_consumo_mensile,giu_consumo_mensile, lug_consumo_mensile, ago_consumo_mensile, set_consumo_mensile, ott_consumo_mensile,nov_consumo_mensile,dic_consumo_mensile

Are 12 columns

I want to make a bar chart with, in the dimension i have months (gen,feb, mar,apr,may, jun,jul,ago,sep,oct,nov,dec) and in the bar the sum of those columns (for JAN i want the sum of GEN_CONSUMO_MENSILE, for FEB i want the sum of FEB_CONSUMO_MENSILE, for MAR i want the sum of MAR_CONSUMO_MENSILE.... and so on till for DEC the sum of DIC_CONSUMO_MENSILE.

How can i do that?

27 Replies
danosoft
Specialist
Specialist
Author

Thanks you Aiolos but i need to show not sum(consumo_mensile) i need to show

Those 12 columns:

gen_consumo_mensile,feb_consumo_mensile, mar_consumo_mensile,apr_consumo_mensile,mag_consumo_mensile,giu_consumo_mensile, lug_consumo_mensile, ago_consumo_mensile, set_consumo_mensile, ott_consumo_mensile,nov_consumo_mensile,dic_consumo_mensile

bar chart with, in the dimension i have months (gen,feb, mar,apr,may, jun,jul,ago,sep,oct,nov,dec)

and in the bar the SUM of those columns (for JAN i want the sum of GEN_CONSUMO_MENSILE, for FEB i want the sum of FEB_CONSUMO_MENSILE, for MAR i want the sum of MAR_CONSUMO_MENSILE.... and so on till for DEC the sum of DIC_CONSUMO_MENSILE.

uacg0009
Partner - Specialist
Partner - Specialist

So which column in your file is the "months" you said, I didn't find it.

chinnuchinni
Creator III
Creator III

take :

dimension: Month

Expression :

=if(Month= 'Jan',sum(GEN_CONSUMO_MENSILE),

  if(Month= 'Feb',sum(FEB_CONSUMO_MENSILE),

   if(Month = 'Mar',sum(MAR_CONSUMO_MENSILE))))

.........

.........

danosoft
Specialist
Specialist
Author

Becouse Months, are not a field in my table, months must be fixed

danosoft
Specialist
Specialist
Author

Can you try to do it in the example i attached? becouse for me it doesn't work

uacg0009
Partner - Specialist
Partner - Specialist

Could you please give a sample and also the desired result you want?

Because I think in my attachment, I just for Jan - sum(gen), Feb - sum(feb). but you said it's not correct.

So could you please tell me the desired result you want? you can make it in excel and screenshot to me.

chinnuchinni
Creator III
Creator III

Hi Daniele,

please try the bellow.

Dimension:

=ValueList('Jan','Feb','Mar','Apr','May','Jun','Jly','Aug','Sep','Oct','Nov','Dec')

expression:

if(ValueList('Jan','Feb','Mar','Apr','May','Jun','Jly','Aug','Sep','Oct','Nov','Dec')= 'Jan',sum(GEN_CONSUMO_MENSILE),


if(ValueList('Jan','Feb','Mar','Apr','May','Jun','Jly','Aug','Sep','Oct','Nov','Dec')= 'Feb',sum(FEB_CONSUMO_MENSILE),


if(ValueList('Jan','Feb','Mar','Apr','May','Jun','Jly','Aug','Sep','Oct','Nov','Dec')= 'Mar',sum(MAR_CONSUMO_MENSILE),


if(ValueList('Jan','Feb','Mar','Apr','May','Jun','Jly','Aug','Sep','Oct','Nov','Dec')= 'Apr',sum(APR_CONSUMO_MENSILE),



if(ValueList('Jan','Feb','Mar','Apr','May','Jun','Jly','Aug','Sep','Oct','Nov','Dec')= 'May',sum(MAG_CONSUMO_MENSILE),


if(ValueList('Jan','Feb','Mar','Apr','May','Jun','Jly','Aug','Sep','Oct','Nov','Dec')= 'Jun',sum(GIU_CONSUMO_MENSILE),


if(ValueList('Jan','Feb','Mar','Apr','May','Jun','Jly','Aug','Sep','Oct','Nov','Dec')= 'Jly',sum(LUG_CONSUMO_MENSILE),


if(ValueList('Jan','Feb','Mar','Apr','May','Jun','Jly','Aug','Sep','Oct','Nov','Dec')= 'Aug',sum(AGO_CONSUMO_MENSILE),


if(ValueList('Jan','Feb','Mar','Apr','May','Jun','Jly','Aug','Sep','Oct','Nov','Dec')= 'Sep',sum(SET_CONSUMO_MENSILE),


if(ValueList('Jan','Feb','Mar','Apr','May','Jun','Jly','Aug','Sep','Oct','Nov','Dec')= 'Oct',sum(OTT_CONSUMO_MENSILE),


if(ValueList('Jan','Feb','Mar','Apr','May','Jun','Jly','Aug','Sep','Oct','Nov','Dec')= 'Nov',sum(NOV_CONSUMO_MENSILE),




if(ValueList('Jan','Feb','Mar','Apr','May','Jun','Jly','Aug','Sep','Oct','Nov','Dec')= 'Dec',sum(DIC_CONSUMO_MENSILE)








))))))))))))138417.PNG

danosoft
Specialist
Specialist
Author

Thanks Praveen i think we are near the solution... i attach the example with your script, is ok now for dimension, only in the script not work the Sum total of the expressions...

for Example select 2017 year, i expect those total in the chart :

gen_consumo_mensile = 1374

feb_consumo_mensile = 1035

mar_consumo_mensile = 907

apr_consumo_mensile = 594

and so on....

those are the totals you see in the table above tha chart

thanks

uacg0009
Partner - Specialist
Partner - Specialist

I don't know whether you see my attachment seriously.

my result is:

Bar Chart with columns table_1.PNG

And you said that's wrong, that's not what you want.

danosoft
Specialist
Specialist
Author

I don't know becouse using your expression in my sample (attached) it not work

i attached before the sample, can you use it to make it correct?