Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

While condition in Expression

I have two columns called Months and values as shown below:

Months  values

----------  ----------

Jan        2

             4

Feb       6

            7

            8

Mar      8

I am writing expressions

Jan:

if(Months='Jan', sum (values)

Feb:

if(Months='Feb', sum (values)

Mar:

if(Months='Mar', sum (values)

Total:

[Jan] + [Feb] + [Mar]

As we move forward, the Months field also adds values for Apr, May...Dec

How do I write an expression in Total so that as Months get added, the total gets updated. I am currently doing a manual sum of each month column to get this Total. ([Jan] + [Feb] + [Mar])

4 Replies
sunny_talwar

Instead of using multiple expressions, why don't you use a pivot table where Month is your pivoted dimension. Once you do this, you can very easily use partial sums to show the sum of all the months

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Where do you plan to use these expressions? In a pivot/straight table, you will will get new months displayed automatically as this is standard behavior in QlikView. On the other hand, concat() can be used to do exactly what you want, but that may be overkill. Care to share a few more details about what you'ld like to display?

Best,

Peter

Anonymous
Not applicable
Author

Using partial sums, I can show the sum of each individual month. I need a column called Total where it sums all the months.

sunny_talwar

There is a way to show the partial sum for all the months. Would you be able to share some sample data to demonstrate what I mean?