Solved

Create a difference column comparing two dates

  • 18 May 2023
  • 2 replies
  • 33 views

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

Ā 

icon

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

Ā 

-Moises

Ā 

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

Reply