Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

markgraham123
Contributor II

Using variables in Set analysis

Hi All,

I'm trying to use an aggregated variable in set analysis with dimension in set analysis:

vVariable1 = (Sum({<[Yesterday] -= {'-'}>}qc_overpick_lines))

vVariable2 =  (Sum({<[Yesterday] -= {'-'}>}qc_mispick_lines))

vVariable3 = (Sum({<[Yesterday] -= {'-'}>}qc_underpick_lines))

In the set analysis, i'm trying to use these variables:

=(Only({<SHIFTNAME= {'A'}>}vVariable1 +vVariable2+vVariable3))

All i'm doing above statement is, using Shift dimension.

But this is not working..

Any help is highly appreciated!

1 Solution

Accepted Solutions
Not applicable

Re: Using variables in Set analysis

Hi Mark, I think you should be using a dollar expansion here. e.g.

     $(vVariable1) + $(vVariable2)+ $(vVariable3).

However it won't work anyway because nested aggregation is not allowed here. Insread can you try this?

=Sum(({<SHIFTNAME= {'A'}, ({<[Yesterday] -= {'-'}>} qc_overpick_lines)

  +

Sum(({<SHIFTNAME= {'A'}, ({<[Yesterday] -= {'-'}>} qc_mispick_lines)

+

Sum(({<SHIFTNAME= {'A'}, ({<[Yesterday] -= {'-'}>} qc_underpick_lines)

You can store each of those expressions in variables and say

=$(v1)+$(v2)+$(v3)

Thanks,

Ram

6 Replies
Not applicable

Re: Using variables in Set analysis

Hi Mark, I think you should be using a dollar expansion here. e.g.

     $(vVariable1) + $(vVariable2)+ $(vVariable3).

However it won't work anyway because nested aggregation is not allowed here. Insread can you try this?

=Sum(({<SHIFTNAME= {'A'}, ({<[Yesterday] -= {'-'}>} qc_overpick_lines)

  +

Sum(({<SHIFTNAME= {'A'}, ({<[Yesterday] -= {'-'}>} qc_mispick_lines)

+

Sum(({<SHIFTNAME= {'A'}, ({<[Yesterday] -= {'-'}>} qc_underpick_lines)

You can store each of those expressions in variables and say

=$(v1)+$(v2)+$(v3)

Thanks,

Ram

markgraham123
Contributor II

Re: Using variables in Set analysis

Ram,

But I have to create too many variables to get to my final layout.

Can we create a single variable which would give us all totals for shift

name A instead of 3 diff. Variables....?

On Tuesday, July 19, 2016, Ramkumar Ramagopalan <qcwebmaster@qlikview.com>

Not applicable

Re: Using variables in Set analysis

Yes Mark. You can put that entire expression into a variable.

Say vShiftNameACalc

=Sum(({<SHIFTNAME= {'A'}, ({<[Yesterday] -= {'-'}>} qc_overpick_lines+ qc_mispick_lines + qc_underpick_lines)

markgraham123
Contributor II

Re: Using variables in Set analysis

This did not work Ram!

=Sum(({<SHIFTNAME= {'A'}, ({<[Yesterday] -= {'-'}>} qc_overpick_lines+ qc_mispick_lines + qc_underpick_lines)



This worked

=(Sum({<SHIFTNAME= {'A'},[Yesterday] -= {'-'}>}qc_overpick_lines))

+

(Sum({<SHIFTNAME= {'A'},[Yesterday] -= {'-'}>}qc_mispick_lines))

+

(Sum({<SHIFTNAME= {'A'},[Yesterday] -= {'-'}>}qc_underpick_lines))

Not applicable

Re: Using variables in Set analysis

I see 2 brackets after Sum. Please remove one.

Sent from my iPhone

markgraham123
Contributor II

Re: Using variables in Set analysis

Thanks a lot Ram!

Community Browser