14 Replies Latest reply: Nov 16, 2015 1:21 PM by jhonatan ben ami

# 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

• ###### Re: Comparing years and months

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

• ###### Re: Comparing years and months

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

• ###### Re: Comparing years and months

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:

- Sangram

• ###### Re: Comparing years and months

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

• ###### Re: Comparing years and months

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

• ###### Re: Comparing years and months

if i have Sum(sales)  as measure,

that means i have to put in the GetFieldSelections?

• ###### Re: Comparing years and months

would mind to help me with syntax?

year=year

sales = sum ( iv_cost)

• ###### Re: Comparing years and months

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.

• ###### Re: Comparing years and months

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)

• ###### Re: Comparing years and months

TNX alot you realiy helping me!!

• ###### Re: Comparing years and months

for some reason its still not working....

• ###### Re: Comparing years and months

Hi Jhonatan,

The fields are case sensitive.

Can you attach the QVF if possible?

Thanks,

Sangram

• ###### Re: Comparing years and months

TRIED IT AGAIN AND IT WORKED!!! tnx alot!!!