Looker expression editor _ subtraction by pivot rows (sum by grouped dimensions, then subtract)

Hi,

I am new to Looker, not sure if it is possible using Looker expression editor to achieve this (I cannot use LookerML, it is limited to only IT department in my company).

Please see the screenshot below. The green part is what I made within Looker data table by pivoting; the yellow part is what I want to achieve. So it is a subtraction by Year & Amount Range, then use 2021 result - 2020 result.  

5dbbf291-a4d8-4df6-9b18-2624c41fe24b.png

Is it possible to do this without using LookerML but by writing expression formula?  Thank you.

2969c68e-519f-4178-9421-687ff79454b2.png
Solved Solved
0 2 2,692
1 ACCEPTED SOLUTION

Hi, never mind, I found a way to do it. Do not use pivot table, but create two measures, then create a table calculation by subtract these two measures . 

View solution in original post

2 REPLIES 2

Hi, never mind, I found a way to do it. Do not use pivot table, but create two measures, then create a table calculation by subtract these two measures . 

You can do the calculation with pivoted fields using Pivot_index function

Example:
pivot_index(${measure}, 1) - pivot_index(${measure}, 2)

Top Labels in this Space