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

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

6 Replies
Miguel_Angel_Baeyens

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

Not applicable
Author

I proceeded in this manner but the readings are not accurate. The fact is that in February we are the sum of the movements of January, March, are the movements in February

Miguel_Angel_Baeyens

Hi,

Then modify the set analysis or the If() so each month has what is supposed to. Or elaborate on the expected results posting here how the table should look like. Actually you only need one Sum() with the [MOIS STOCK] less than or equal to the month up to you want to get results. [MOIS STOCK] is the dimension as well, so each month will return its values.

Hope that helps

Miguel

Not applicable
Author

in a table I would like to display default values ​​Jan Feb Mar as shown in Table I the values ​​when I select the month and by default it only shows in January
Not applicable
Author

in a table I would like to display default values ​​Jan Feb Mar as shown in Table I the values ​​when I select the month and by default it only shows in January.

Miguel_Angel_Baeyens

Hi,

There is a synthetic key in your model that is interfering in your charts. Your file above does not have any script, so I don't know how to avoid it. Make sure you remove it and try with the expressions suggested.

Regards,

Miguel