Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Quy_Nguyen
Specialist
Specialist

Sales comparison vs last year

Hello,

I have the data sample and expected result like this:

1.PNG

I used:

If(Flag_This_Year = 1, Date) for the dimension,

Sum({<Date ={"$(=AddYears(Max(Date),-1))"}>}Sales) for measure sale last year, but got wrong result.

I know that it can be done with join function in data load script, I am looking for a solution on dashboard.

Any help would be greatly appreciated.

1 Solution

Accepted Solutions
Neymar_Jr
Creator II
Creator II

Hi,

Please see if this helps.

Thanks,

RT

View solution in original post

14 Replies
agastya
Creator
Creator

hi Quy You are restricting the Dimesnion field i.e If(Flag_This_Year = 1, %Date) lasy year will show "0" sales

Quy_Nguyen
Specialist
Specialist
Author

Hi Vishal,

Thanks for your reply. So could you please guide me how to achieve the result table?

agastya
Creator
Creator

Could you tell me the Expected  Result So i can change the expression!

Quy_Nguyen
Specialist
Specialist
Author

Expected result is the picture in the original post

big_dreams
Creator III
Creator III

Hi,

try below logic

Table1:

Load * from table1;

Noconcatenate:

Current_year_Data:

Load date as year_date,

         sales as this_year_sales

Resident Table1

where flag_this_year=1;

join

Load date(AddYear(date,1)) as year_date,

         sales as prev_year_sales

Resident Table1

where flag_this_year=0;

In front end

take straight able

dimension

year_date

Expression:

1: sum(this_year_sales)

2: sum(prev_year_sales)

Regards,

Quy_Nguyen
Specialist
Specialist
Author

Thanks for your reply, i am looking for a solution in front end without changing script. Is it possible?

Neymar_Jr
Creator II
Creator II

Hi ipcducquy,

Please see if the attached helps you.

Thanks

RT

agigliotti
Partner - Champion
Partner - Champion

I guess you can't.

Quy_Nguyen
Specialist
Specialist
Author

Thanks Rajesh, but i want to view data by date, not by month. I got 60 dates in 2 months of 2017 and 60 dates in the same months of 2018.