6 Replies Latest reply: Jun 6, 2018 1:44 AM by Elias Lohilahti RSS

    Problems on calculating a daily sum and then a monthly maximum

    Elias Lohilahti

      Hi!

       

      I have data on single transactions, and I would need to sum daily amounts and then get a monthly maximum of them. I think it would be easy either to calculate daily sums from single transactions or to calculate monthly maximum from the daily sums, but I can't seem to find a way to do this kind of a two-dimensional aggregation e.g. in Bar Charts and Pivot Tables. Do I need to do some aggregations already in the Data Load editor? Tried to do as follows, but loading the data lead to an error.

       

      LTB CONNECT TO [database]

       

      [tablename]:

      LOAD

      [contractno]

      Date([dateno]),

      [dailysum];

      SQL

      SELECT "contractno", "dateno", SUM("a" / "b") AS "dailysum"

      FROM "Database"."table1", "Database"."table2"

      WHERE "contract1" = "contract2"

      GROUP BY "dateno";