Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
geogou1973
Creator
Creator

compare current vs previous sales by month

Hello.

How i can compare current vs previous sales by giving the current year in selection and the month

and return me in a chart the sales for the month of the current year and the month for the previous year.

I have created a variable for the previous year     vPreviousYear=(Year)-1

and in the expression i give the following:

=Sum({<YEAR={'$(vPreviousYear)'},MONTH_ID=>}sales)

and returns me  0

4 Replies
Not applicable

Try Below:

=Sum({1<YEAR={"$(=Max(YEAR)-1)"},MONTH_ID=>}sales)


If you selected the YEAR value 2013, the data for 2012 was greyed out. SO you need to put {1} to ignore the current selections.

geogou1973
Creator
Creator
Author

It returns me wrong sales. Very big amounts.

Not applicable

Please post sample qvw or some test data.

Yousef_Amarneh
Partner - Creator III
Partner - Creator III

just go to the variable and but equal sign before the expression, so it should be =(Year)-1 instead of (Year)-1

Yousef Amarneh