Question

Week over Week vs the prior week in Country

  • 15 January 2019
  • 2 replies
  • 3959 views

I want to create a calculation that shows me the % Week over Week vs the prior week in [Country] using functions.

(B-A/A)*100

Maybe using offset_list help? Thanks in advance!


2 replies

Userlevel 3

@prol depending on your exact use case there are a couple of ways to achieve a week over week calculation.


Using order_items.count as an example of a kpi we want to report on, for a single value visualization vs. the week before we can use a simple offset function:


offset(${order_items.count},1)


Then use Looker’s built-in comparison option in the viz settings:



If we want to plot this over time then we can do something like:


(${order_items.count} - offset(${order_items.count},1))
/
${order_items.count}

which we can then plot on a chart, even adding a pivot on country if we want:



Hope that helps!

Thanks! This was helpful.

Reply