Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
drj12345
New Contributor III

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

Re: While condition in Expression

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

Re: While condition in Expression

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

drj12345
New Contributor III

Re: While condition in Expression

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

Re: While condition in Expression

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?