Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to do i do these set analysis

See this set analysis. I have 12 fields Jan.... Dec with values. how do i pick all these months in one expression?

Sum({<Year={2013}> Jan, Feb, Mar.... Dec )    How do i do this?

11 Replies
sunny_talwar

May be this:

Sum({<Year={2013}> (Jan+Feb+Mar+.... +Dec))

or

RangeSum(Sum({<Year={2013}> Jan), Sum({<Year={2013}> Feb), Sum({<Year={2013}> Mar), ....., Sum({<Year={2013}> Dec))

cesaraccardi
Specialist
Specialist

Hi,

You might want to consider changing the data model of your application to a vertical model rather than having a field for each month, that could possibly make your life a lot easier. QlikView has a CrossTable loading command specifically for this kind of dataset.

Regards,

Cesar

Colin-Albert

Would it be better to change your data model so the Month is a dimension and you just have one measure field?

Then you can select months in a list box along with year and use a simple expression such as sum(value)  or

sum({<Year = {2013}>} Value)

Not applicable
Author

Didnt work

Colin-Albert

As CesarAccardi‌ suggests, look at the Cross Table function in your load script, and avoid having 12 value fields.

The Crosstable Load

Not applicable
Author

What i wanna achieve dont need the data model to be changed

Chanty4u
MVP
MVP

Hi,

You can do this by following way.

Tab1:
SQL
Select Date,Month(Date) as Months,Sales From yoursqltable

Months:
Load * INLINE [
Months, Month
01, Jan
02, Feb
03, Mar
04, Apr
05, May
06, Jun
07, Jul
08, Aug
09, Sep
10, Oct
11, Nov
12, Dec
];

After reloading you qv document create the new list box and select the "Month" field on this list box.

Then your list box will display Jan,Feb,Mar,...,Dec.

Chanty4u
MVP
MVP

or

DUAL(Month(YourDate), MonthName(YourDate)) AS Month

Colin-Albert

You can do it without changing the data model, but you will need to sum 12 expressions.

     Sum({<Year={2013}> Jan) + Sum({<Year={2013}> Feb) + ... + Sum({<Year={2013}> Dec)

A well structured data model will be more efficient going forward.