For Loop in Looker

Hi, 

I want to use for loop in LookML file to do like something below:

5ecd859b-c028-4ee8-b493-5ce02c88fc84.png

I don’t want to write 1, 2, 3 for each same measure. 

How can I do this with for loop or somelike for loop in LookML?

0 3 1,304
3 REPLIES 3

Not sure I understand what you are looking to do.  The Dimension will be used to create a SQL Statement.  So what would that “For Loop” look like in a block of SQL?

However, if you are just looking to create a single Dimension where the result is 1,2 , or 3 depending on the datediff between $[date_date} and getdate(). 

If so then:

You just need to extend the case statement for the three conditions

OR

Just display the value returned by datediff but you could get values other than 1,2 or 3 depending on the data.

Do you need all the measures to be available at the same time? If not, you could use a parameter and let the person choose the day offset (1,2,3...), if yes, then you have to write each statement. There’s no way to wrap LookML statements in loops

Yes David, I need all the measures to be writable at the same time. It would be nice it was, thanks.

Top Labels in this Space
Top Solution Authors