Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Comparing years and months

Hey I am trying to compare sales by years and months meaning

February 2014 sales vs February 2013 sales how can I preform this?

And how can I show it on percentages?

I am adding a picture of my app

my table.PNG

1 Solution

Accepted Solutions
reddy-s
Master II
Master II

No probelm,

So that would be :

1) sum(iv_cost) - assuming year 2014 is selected

2) sum({$< year = {'$(=num((GetFieldSelections(year) - 1), '###0' ))'}>} iv_cost)

View solution in original post

14 Replies
Chanty4u
MVP
MVP

Not applicable
Author

hey sureshqv , tnx for your help but i belive the soultion will be changing / applying things on the App itself....

Not applicable
Author

i need the user to have the ability to change it manually...

reddy-s
Master II
Master II

Hi Jhonatan,

From the description of the problem, I think you need some thing like this. When 2014 and  Feb is selected, the results should be compared to 2013 - Feb right?

If so check this out:

S1.PNGS2.PNG

- Sangram

Not applicable
Author

Exactly !! yes thats what i need how can i do it ?

reddy-s
Master II
Master II

Hi Jhonatan,

Just create two measures like this:

1) sum([Field])

2) sum({$< Year = {'$(=num((GetFieldSelections(Year) - 1), '###0' ))'}>} [Field])

Create these measure and make use of them in your chart.

As @sureshgv mentioned, the best practice is to do it in the script which gives you better performance.

Hope this helps!

- Sangram

Not applicable
Author

if i have Sum(sales)  as measure,

that means i have to put in the GetFieldSelections?

Not applicable
Author

would mind to help me with syntax?

year=year

sales = sum ( iv_cost)

reddy-s
Master II
Master II

Hi Jhonatan,

Then just use these expressions:

1) sum(sales) - assuming year 2014 is selected

2) sum({$< Year = {'$(=num((GetFieldSelections(Year) - 1), '###0' ))'}>} sales) - this will give you the sum of sales for 2013 considering any other month or quarter selections as well.