3 Replies Latest reply: Jan 5, 2012 3:35 PM by markpinches RSS

    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

       

        • Re: Noob help!
          Dan Heller

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

           

          If(GetSelectedCount([Field])>0,

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

          Avg(BODYWEIGHT))

           

          Cheers!

          Dan

            • Noob help!

              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

                • Noob help!

                  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))