Looker difference between two pivoted columns

Viewed 271

I’m trying to get the differences between test and control for segments 1 and 2.

Disregard the values that you see in the Diff column. I’m currently using pivot_offset, but that applies to every column.

enter image description here

1 Answers

You can use an if function to check if the segment is the same, this will return null values into the columns you highlighted in red.

if(${view.segment}=pivot_offset(${view.segment},-1),
   ${view.metric}-pivot_offset(${view.metric},-1),
   null)
Related