Question

Emulate a function call in LookML

  • 12 November 2021
  • 0 replies
  • 9 views

Figure out this SQL code:

SELECT client_id, 
fn_getComplexCalculation(client_id,
DATE(“10-01-2020”),
DATE(“10-01-2021”))
FROM clients

 

Lets assume that clients table is enough big and the function enough complex to have enough reason to run this SQL code as well applying the function by each client_id.

 

A potential idea is to create an explore with those 3 filters and call the explore from the dimension:

dimension: {

type: number

explore: complex_calculation

bind: {

complex_caclulation.client_id : ${client_id},

complex_caclulation.start_date : ${fiters.start_date},

complex_caclulation.end_date : ${fiters.end_date},

}
result: complex_calculation.calculated_measure

}


Obviously the explore have to return a single row with a single column.

 

Unfortunately this feature is not actually supported by Looker.

 

Anyone knows how can emulate the function call on LookML code?

Any news about if Looker will support this in the future?


0 replies

Be the first to reply!

Reply