Create a difference column comparing two dates

  • 18 May 2023
  • 2 replies

I have two columns, revenue this week and revenue last week, and I am looking to add a third column which shows the difference between the two. I believe this might be able to be done with a new metric. Does anyone have an idea how to execute this? Cheers



Best answer by Moises Morales 18 May 2023, 17:29

View original

2 replies

Userlevel 3

Hi James, 

I believe something like this could work: 

SELECT (SELECT SUM(revenue) WHERE Week (Sun-Sat) (Date) = THIS)-(SELECT SUM(revenue) FOR Previous(Week (Sun-Sat) (Date)))

You can find in the documentations below the details about the keywords in questions: 

FOR Previous | GoodData Free

THIS Macro | GoodData Free




Thank you! I have ended up splitting into two different metrics but that general idea got me what I needed.