user04420 Member

Comments

  • Hi Thanks for your reply. And yes that is exactly what I was trying to do. I wanted to get the weekly revenue from 12 weeks ago. I'll try to play around your functions and see if it will work and let you know
  • sum(CASE WHEN WEEK(DATE_SUB(Current_Date(), INTERVAL 12 WEEK)) = WEEK(`day`) AND YEAR(DATE_SUB(Current_Date(), INTERVAL 12 WEEK)) = YEAR(`day`) THEN `grossRevenue` END) did not give me the revenue from 12 weeks ago for some reason 
  • Hi. You are totally right! The problem is that the code didn't return anything. So what I'm trying to do is to get revenue from 12 weeks ago to compare it to the revenue from last week. Cheers, Leon
  • Hi, Thanks so much! But apparently this did not work out too well. I think the date_sub function is not used properly here. Please see my code for the details. CASE WHEN sum(CASE WHEN WEEKOFYEAR(`day`) = WEEKOFYEAR(CURRENT_DATE()) - 1 THEN `grossRevenue` END) > 100 AND sum(CASE WHEN WEEK(DATE_SUB(Current_Date(), INTERVAL…