Kapacitor - math with multi series and multi measurements

#1

Hi, I want to get two series from measurement no1 then math with one serie from a second measurement and finally math with a serie from a third measurement

Getting data from database is not the problem queries:

   var abc = batch
        |query('''
             SELECT mean("value") AS "Usage", mean("instant") AS "Instant"
             FROM "domoticz"."autogen".Usage
         ''')
            .period(1m)
            .every(15s)
            .align()
            .groupBy(time(1m), *)
        |httpOut('a')

    var def = batch
    |query('''
         SELECT mean("value") AS "value"
         FROM "domoticz"."autogen".Temperature
         WHERE "name" = 'Allrum_T'
     ''')
        .period(1m)
        .every(15s)
        .align()
        .groupBy(time(1m))
    |httpOut('b')

var ghi = batch
    |query('''
         SELECT mean("value") AS "Ute"
         FROM "domoticz"."autogen".Temperature
         WHERE "name" = 'Ute_T'
     ''')
        .period(1m)
        .every(15s)
        .align()
        .groupBy(time(1m))
    |httpOut('c')

Below is working fine, I get what I expect

abc
     |join(def)
         .as('abc', 'def')
         .on('def')
     |eval(lambda: "abc.Usage" + "abc.Instant" + "def.value")
         .as('new')
     |httpOut('d')

But how can I do math with “new” and “ghi.Ute”?