6 Replies Latest reply: Jan 20, 2012 7:10 AM by Miguel Angel Baeyens de Arce RSS

    display the result of an expression without selection

      Hello,

      I have a QlikView application and I would be displayed by default Jan Feb and March

      but this expression written it displays only Jan but in February and March values do not appear at the selection. I have attached the file so that you have an idea of what I did

        • Re: display the result of an expression without selection
          Miguel Angel Baeyens de Arce

          Hi,

           

          Try the following instead (I have separated each line just for make it more readable). The [MOIS STOCK] was only compared to be less than or equal to 1 instead of 2 in the first else (when [MOIS STOCK] equals to 2) and likewise with [MOIS STOCK] = 3, where set analysis was set to be less than or equal to 2 (instead of 3).

           

          if([MOIS STOCK] = 1 and PRODUITS <> '80.Melasse',
            (Sum({$<[MOIS STOCK]={"<=1"}>} [QUANTITE EXO])),
            if([MOIS STOCK] = 2 and PRODUITS <> '80.Melasse', 
            (Sum({$<[MOIS STOCK]={"<=2"}>} [QUANTITE EXO])
            +Sum({$<[MOIS STOCK]={"<=2"}>} [QUANTITE Production])
            +Sum({$<[MOIS STOCK]={"<=2"}>} [QUANTITE TransfertPlus])
            +Sum({$<[MOIS STOCK]={"<=2"}>} [QUANTITE Entree]))
            +(Sum({$<[MOIS STOCK]={"<=2"}>} [QUANTITE Cession])
            +Sum({$<[MOIS STOCK]={"<=2"}>} [QUANTITE Sortie])
            +Sum({$<[MOIS STOCK]={"<=2"}>} [QUANTITE TransfertMoins])
            +Sum({$<[MOIS STOCK]={"<=2"}>} [QUANTITE Vente])),
            if([MOIS STOCK] = 3 and PRODUITS <> '80.Melasse',
            (Sum({$<[MOIS STOCK]={"<=3"}>} [QUANTITE EXO])
            +Sum({$<[MOIS STOCK]={"<=3"}>} [QUANTITE Production])
            +Sum({$<[MOIS STOCK]={"<=3"}>} [QUANTITE TransfertPlus])
            +Sum({$<[MOIS STOCK]={"<=3"}>} [QUANTITE Entree]))
            +(Sum({$<[MOIS STOCK]={"<=3"}>} [QUANTITE Cession])
            +Sum({$<[MOIS STOCK]={"<=3"}>} [QUANTITE Sortie])
            +Sum({$<[MOIS STOCK]={"<=3"}>} [QUANTITE TransfertMoins])
            +Sum({$<[MOIS STOCK]={"<=3"}>} [QUANTITE Vente]))
            ,0)))
          

           

          I'd recommend you to create this huge sum in the script, making the expression simpler, or use only one Sum() with several fields, that should work also:

           

          Sum({< [MOIS STOCK] = {"<=2"} >} [QUANTITE EXO] + [QUANTITE Production] + [QUANTITE TransfertPlus] + [QUANTITE Entree])
          

           

          Hope that helps.

           

          Miguel