Question

% DIFF BETWEEN DATE Y AND DATE Y -1

  • 26 May 2021
  • 1 reply
  • 29 views

Hello all,

 

I was wondering how can I have a % difference between a metric shown on data range Y vs the prior data range.

 

Ex. Spend of the last 7 days vs Spend of previous 7 days

Date Filter: Last 7 Days

Name: ABC ;  Spend Last 7 Days: 100$ ; Spend prior 7 days (8 - 14 days): 120$ ; % Diff: -16%

 

Thanks
 


This topic has been closed for comments

1 reply

Userlevel 6
Badge +1

If you set a filter of Last 7 Days then your SQL will have WHERE clause that limits the data pulled to Looker to only those seven days.

One way to do it would be change it to 14 days. Create a custom dimension Yes/No where Yes = In the last 7 days. You could then Hide Nos from the visualisation (14-8 day in the past) and then decide whether you need to aggregate it (having only 2 rows) or by day (14 rows split into two groups)