Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

what is wrong with set analysis

Hi

I have a plot chart with 2 dimension Annee & Mois

I want to calculate for each month an index based on january (Mois=01)

so my expression is:

Sum ([CA HT en euros]) / Sum ( {<Mois=01>} [CA HT en euros])

But no chart is displayed.

In my input table the field Mois take the value 01, 02 , ...., 12

Thanks in advance for your help

Jean-Jacques

4 Replies
Not applicable
Author

I'm guessing those months are strings as they have a leading zero. Try:

Sum ([CA HT en euros]) / Sum ( {<Mois='01'>} [CA HT en euros])


This expression is respecting the dimension for the record it is in. I'd guess you want something like:

Sum ([CA HT en euros]) / Sum ( {<Mois='01'>} TOTAL [CA HT en euros])


That will get you the sum for whatever dimension you have divided by the total for January, ignoring the dimension.

Not applicable
Author

Thanks NMiller for your answer but it didn't work. You guessed well about the calculation.

As i have also the year in the file, i created a new field as :

Monthname( Makedate(Annee , Mois)) as MonthName ,

How can write the expression using MonthName = January ? I'm sure you have an idea and allow to bypass the string for Month.

JJ

Miguel_Angel_Baeyens

Hello Jean-Jacques,

If you have set a MonthNames variable in your script (it is by default), you may use for your set analysis something like

Sum ( {<Mois = {$(=Subfield(MonthNames, ';', Num(Mois)))} >} [CA HT en euros])
where the subfield function will return your default month name...

Not applicable
Author

Maybe something like:

Sum ([CA HT en euros]) / Sum ( {<MonthName='Jan'>} TOTAL [CA HT en euros])


You'll need to verify the format of your MonthName field and format the set modifier accordingly.