Join us on August 11th as we explore Emotion Classification on Video with phData Learn more

Set Dataset Metric in Global Variables

Level 3
Set Dataset Metric in Global Variables

I want to calculate the last day of a column in a dataset and use it dynamically in my SQL recipe.  I'm not using Python so I don't know how to set it as a variable.  Is there a way to call the metric straight from the SQL recipe?  Or send the metrics to global variables after the dataset build?

 

 

0 Kudos
1 Reply
Dataiker
Dataiker

Hi @gblack686 

If you're using SQL for your recipe and the statement looks something like this:

SELECT column_1
       , column_2
       , column_date 
FROM table

you can just modify this to be 

SELECT column_1
       , column_2
       , column_date
       , (SELECT MAX(column_date) FROM table) AS column_date_max
FROM table

 This syntax can sometimes be inefficient if dealing with many such columns on large and non-indexed tables, but it's simple to follow without needing joins.