Question

Modelling differences between running total measures in lookml


Userlevel 2

Hi, I was wondering if anyone has ever created a measure that is the difference between two running totals in lookml. would be interested to hear any thoughts.


as an example, if i have the following account $ deposit data, i want to create a measure to calculate the running total of each account’s deposits and then find the difference between these two running totals through time:


SELECT '12/31/2016' date, 'a' account, 0.469365 deposits union all
SELECT '01/01/2017' date, 'a' account, 0.480059 deposits union all
SELECT '01/02/2017' date, 'a' account, 0.758905 deposits union all
SELECT '01/03/2017' date, 'a' account, 0.037924 deposits union all
SELECT '01/04/2017' date, 'a' account, 0.149676 deposits union all
SELECT '01/05/2017' date, 'a' account, 0.323894 deposits union all
SELECT '01/06/2017' date, 'a' account, 0.346235 deposits union all
SELECT '01/07/2017' date, 'a' account, 0.207945 deposits union all
SELECT '01/08/2017' date, 'a' account, 0.894186 deposits union all
SELECT '01/09/2017' date, 'a' account, 0.234514 deposits union all
SELECT '01/10/2017' date, 'a' account, 0.671572 deposits union all
SELECT '01/11/2017' date, 'a' account, 0.447208 deposits union all
SELECT '01/12/2017' date, 'a' account, 0.930299 deposits union all
SELECT '01/13/2017' date, 'a' account, 0.844901 deposits union all
SELECT '01/14/2017' date, 'a' account, 0.904399 deposits union all
SELECT '01/15/2017' date, 'a' account, 0.711566 deposits union all
SELECT '12/31/2016' date, 'b' account, 0.224464 deposits union all
SELECT '01/01/2017' date, 'b' account, 0.122673 deposits union all
SELECT '01/02/2017' date, 'b' account, 0.279756 deposits union all
SELECT '01/03/2017' date, 'b' account, 0.700634 deposits union all
SELECT '01/04/2017' date, 'b' account, 0.752186 deposits union all
SELECT '01/05/2017' date, 'b' account, 0.803469 deposits union all
SELECT '01/06/2017' date, 'b' account, 0.86433 deposits union all
SELECT '01/07/2017' date, 'b' account, 0.912829 deposits union all
SELECT '01/08/2017' date, 'b' account, 0.411036 deposits union all
SELECT '01/09/2017' date, 'b' account, 0.497262 deposits union all
SELECT '01/10/2017' date, 'b' account, 0.521278 deposits union all
SELECT '01/11/2017' date, 'b' account, 0.877157 deposits union all
SELECT '01/12/2017' date, 'b' account, 0.910962 deposits union all
SELECT '01/13/2017' date, 'b' account, 0.85336 deposits union all
SELECT '01/14/2017' date, 'b' account, 0.180705 deposits union all
SELECT '01/15/2017' date, 'b' account, 0.476473 deposits




0 replies

Be the first to reply!

Reply