# QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Rules, plus terms and conditions, can be found here.
Valued Contributor II

## How to combine 2 chart into 1 ?

Hi All

I have chart 1 Expression as below :-

money(

sum({\$<year = {">=\$(=max(year),4)"}, month = {"<=\$(=max({<year={\$(=max(year))}>} month))"}>}\$(ColumnDim51)/\$(Columndim89)/1000)

, \$(vMoneyFormatK))

I have chart 2 expression as below :-

money(pick(

match([Pls select 66 Dim],'rEVENUE','sales','eXP','n_PRO'),

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)/1000,

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)/1000,

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)*-1/1000,

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)/1000 ),

\$(vMoneyFormatK))

My imagine Solution as below not working  :-

money(pick(

match([Pls select 66 Dim],'rEVENUE','sales','eXP','n_PRO'),

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)/1000,

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)/1000,

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)*-1/1000,

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)/1000 ),

match([Pls select 6st Dim],'sales','cost','profit'),

sum({\$<year = {">=\$(=max(year),4)"}, month = {"<=\$(=max({<year={\$(=max(year))}>} month))"}>}\$(ColumnDim51)/\$(Columndim89)/1000),

\$(vMoneyFormatK))

)

Hope some one can advise me where go wrong ?

Next posting i will post my QC Doc.

Paul

1 Solution

Accepted Solutions
MVP

## Re: How to combine 2 chart into 1 ?

Slight modification to the second expression:

Alt(

Money(Pick(Match([Pls select 66 Dim],'rEVENUE','sales','eXP','n_PRO'),

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)/1000,

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)/1000,

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)*-1/1000,

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)/1000),\$(vMoneyFormatK)),

Money(If(Match([Pls select 6st Dim],'sales','cost','profit'),

Sum({\$<year = {">=\$(=max(year),4)"}, month = {"<=\$(=max({<year={\$(=max(year))}>} month))"}>}\$(ColumnDim51)/\$(Columndim89)/1000)), \$(vMoneyFormatK)))

12 Replies
Valued Contributor II

My QV Doc

MVP

## Re: How to combine 2 chart into 1 ?

are [Pls select 66 Dim] & [Pls select 6st Dim] different field?

Valued Contributor II

## Re: How to combine 2 chart into 1 ?

Hi Sir

They are diff field name. By the way i try using Mr Avinash expression , and insert my new condition , it work fine :-

if

(

match([Pls select 66 Dim],'rEVENUE','sales','n_PRO' ),

money(

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)/1000,

\$(vMoneyFormatK)),

if

(

match([Pls select 66 Dim],'eXP'),

money(

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)*-1/1000,

\$(vMoneyFormatK)),

if

(

match([Pls select 6st Dim],'sales','cost','profit'),

money(

sum({\$<year = {">=\$(=max(year),4)"}, month = {"<=\$(=max({<year={\$(=max(year))}>} month))"}>}\$(ColumnDim51)/\$(Columndim89)/1000),

\$(vMoneyFormatK)),

)))

But now i encounter , some issue , that is the chart take very long to plot. may i know it there any expression can make the chart plot faster ?

MVP

## Re: How to combine 2 chart into 1 ?

try below

if(getselectedcount([Pls select 66 Dim])>0,

money(pick(

match([Pls select 66 Dim],'rEVENUE','sales','eXP','n_PRO'),

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)/1000,

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)/1000,

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)*-1/1000,

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)/1000 ),

\$(vMoneyFormatK)),

if(getselectedcount([Pls select 6st Dim])>0,

money(Pick(match([Pls select 6st Dim],'sales','cost','profit'),

sum({\$<year = {">=\$(=max(year),4)"}, month = {"<=\$(=max({<year={\$(=max(year))}>} month))"}>}\$(ColumnDim51)/\$(Columndim89)/1000),

\$(vMoneyFormatK))))

or

alt(

money(pick(

match([Pls select 66 Dim],'rEVENUE','sales','eXP','n_PRO'),

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)/1000,

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)/1000,

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)*-1/1000,

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)/1000 ),

\$(vMoneyFormatK)),

money(Pick(match([Pls select 6st Dim],'sales','cost','profit'),

sum({\$<year = {">=\$(=max(year),4)"}, month = {"<=\$(=max({<year={\$(=max(year))}>} month))"}>}\$(ColumnDim51)/\$(Columndim89)/1000),

\$(vMoneyFormatK)))

Valued Contributor II

## Re: How to combine 2 chart into 1 ?

Hi Kush

Thank you for offer me 2 proposal on expression . I have try but it never work .

Can you advise me pls ?

Paul

MVP

## Re: How to combine 2 chart into 1 ?

hav you tried this?

alt(

money(pick(

match([Pls select 66 Dim],'rEVENUE','sales','eXP','n_PRO'),

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)/1000,

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)/1000,

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)*-1/1000,

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)/1000 ),

\$(vMoneyFormatK)),

money(Pick(match([Pls select 6st Dim],'sales','cost','profit'),

sum({\$<year = {">=\$(=max(year),4)"}, month = {"<=\$(=max({<year={\$(=max(year))}>} month))"}>}\$(ColumnDim51)/\$(Columndim89)/1000)),

\$(vMoneyFormatK)))

MVP

## Re: How to combine 2 chart into 1 ?

Slight modification to first expression proposed by Kush:

If(GetSelectedCount([Pls select 66 Dim]) > 0,

Money(Pick(Match([Pls select 66 Dim],'rEVENUE','sales','eXP','n_PRO'),

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)/1000,

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)/1000,

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)*-1/1000,

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)/1000),\$(vMoneyFormatK)),

If(GetSelectedCount([Pls select 6st Dim]) > 0,

Money(If(Match([Pls select 6st Dim],'sales','cost','profit'),

Sum({\$<year = {">=\$(=max(year),4)"}, month = {"<=\$(=max({<year={\$(=max(year))}>} month))"}>}\$(ColumnDim51)/\$(Columndim89)/1000)), \$(vMoneyFormatK))))

MVP

## Re: How to combine 2 chart into 1 ?

Slight modification to the second expression:

Alt(

Money(Pick(Match([Pls select 66 Dim],'rEVENUE','sales','eXP','n_PRO'),

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)/1000,

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)/1000,

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)*-1/1000,

Sum({<\$(ColumnDim51)={\$(ColumnDim51)}>}Amount)/\$(Columndim89)/1000),\$(vMoneyFormatK)),

Money(If(Match([Pls select 6st Dim],'sales','cost','profit'),

Sum({\$<year = {">=\$(=max(year),4)"}, month = {"<=\$(=max({<year={\$(=max(year))}>} month))"}>}\$(ColumnDim51)/\$(Columndim89)/1000)), \$(vMoneyFormatK)))

MVP

## Re: How to combine 2 chart into 1 ?

I think I missed on closing bracket. Thanks sunny for correction