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: 
tleivamo
Contributor III
Contributor III

How to sum range of values

Hi everybody,

I need your help with this issue:

I just trying to consolidate the values from January to Month-N (N= someone month) as a filter, because I need to reflect the total in a pivot table. Let me give an example with this table:

MONTH= Dimension

PEOPLE_IN: Measure

PEOPLE_OUT: Measure

MONTHPEOPLE_INPEOPLE_OUT
JANUARY150200
FEBRARY200220
MARCH178180
APRIL180190
MAY190210
JUNE150120
JULY170130
AGOST160180
SEPTEMBER185198
OCTUBER190140
NOVEMBER200130
DICEMBER110150

If I select January the table show it only the values from January, but if I select March the table should show me the total value from Jan to March (Jan+Feb+March) at the same time the filter should select all months back.

Filter: Jan

Select Jan

MONTHPEOPLE_INPEOPLE_OUT
JANUARY150200

Filter: Jan+Feb+March

Select Jan to March

MONTHPEOPLE_INPEOPLE_OUT
JANUARY528600
FEBRARY528600
MARCH528600

I believe that Sum(Total.....) might be a possible but really I don't know how used and how to do this.

I hope you can help me.

PD. Sorry if my english have some mistakes...

16 Replies
tleivamo
Contributor III
Contributor III
Author

Hi Umar,

No, it isn't. I'm really expecting something like this:

MONTHPEOPLE_INPEOPLE_OUT
MARCH528600

If I select March, the sum should be reflect the total (Jan+Feb+March) in PEOPLE_IN and PEOPLE_OUT

swuehl
MVP
MVP

I believe what you want can be achieved with an AsOf table approach, as described by HIC in the blog post I've posted in my last answer.

It basically creates a new field AsOfMonth, that links each month value to all previous months values, e.g. March to March, February, January. Use this field as dimension in your table chart.

OmarBenSalem

Have u tried my solution?

That's exactly what's it's giving back

OmarBenSalem

Capture.PNG

tleivamo
Contributor III
Contributor III
Author

Hi omarbensalem,

It's true, your solution really works, but I don´t want to sum all values from the begining. I mean, I want some like this

The table should show the data in "normal state"

first.png

After, when the filter is apply, it should show the sum of the values from Jan to Month selected:

SECOND.png

Is it possible??

OmarBenSalem

then change the expression as follow:

if(GetSelectedCount(MONTH)=0,sum(PEOPLE_IN), sum(total {1<NumMonth={"<=$(=max(NumMonth))"}>}PEOPLE_IN))

if(GetSelectedCount(MONTH)=0,sum(PEOPLE_OUT), sum(total {1<NumMonth={"<=$(=max(NumMonth))"}>}PEOPLE_OUT))

Capture.PNG

Capture.PNG

tleivamo
Contributor III
Contributor III
Author

Hi omarbensalem‌,

It's perfect now!!

Many thanks to you and everybody!!