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: 
Not applicable

Noob help!

Hi all,

I'm new to QlikView app development, and need some help with a little problem that has been driving me mad....

I am trying to draw a line chart that shows bodyweight change over time.

Dimensions are DAY and a cyclic group of INDIVIDUAL and GROUP 

The basic expression is Avg(BODYWEIGHT), that works just fine.

The INDIVIDUALs are in GROUPs (numbered) that also carry a descriptor of either "control" or "treated" in GROUPCLASSNAME.

What I want to do is, when a user selects a specific treated group or individual, they will see the data from that selection as well as the data from the  control groups or individuals (depending upon the choice on the cyclic group) also on the same chart (e.g. in light grey). So they can get an idea of the change in the treated group/Ind in relation to the controls.

Avg(($<GROUPCLASSNAME={"*Control"}>}BODYWEIGHT) gives me just the control groups. But I want to see all the groups when no selections are made (i.e. as with Avg(BODYWEIGHT) and just the selected groups and the "Control" groups when a selection is made.

I guess its pretty simple set analysis, but its flumoxed me for the last 3 hrs and I'm beginning to pull my hair out!

Any help appreciated!

M

1 Solution

Accepted Solutions
Not applicable
Author

Hi Dan (and others),

Using the idea of Dans to Flik Flak between expressions based on the if expression I solved the issue last night with the following code. Simple really!

If(GetSelectedCount(GROUPNR)>0,

Avg ({$<GROUPNR=,GROUPCLASSNAME={"*Control"}>+$<GROUPNR={$(=GetFieldSelections(GROUPNR))}>}BODYWEIGHT)

,Avg (BODYWEIGHT))

View solution in original post

3 Replies
dwh1104
Creator II
Creator II

Pretty sure you could use something similar to the following...

If(GetSelectedCount([Field])>0,

Avg($<GROUPCLASSNAME={"*Control"}>}BODYWEIGHT),

Avg(BODYWEIGHT))

Cheers!

Dan

Not applicable
Author

Thanks Dan,

But no use. I get the No data to display error, regardless of which field I complete or how I set up the if statement.

Time to think again!

M

Not applicable
Author

Hi Dan (and others),

Using the idea of Dans to Flik Flak between expressions based on the if expression I solved the issue last night with the following code. Simple really!

If(GetSelectedCount(GROUPNR)>0,

Avg ({$<GROUPNR=,GROUPCLASSNAME={"*Control"}>+$<GROUPNR={$(=GetFieldSelections(GROUPNR))}>}BODYWEIGHT)

,Avg (BODYWEIGHT))