COGNOiSe.com - The IBM Cognos Community

IBM Cognos Analytics Platform => Cognos Analytics => Reporting => Topic started by: dougp on 21 Oct 2020 12:50:22 PM

Title: SQL Window Functions
Post by: dougp on 21 Oct 2020 12:50:22 PM
Using Cognos 11.0.13 with a relational model...

Is it possible to use SQL window functions (like LEAD, LAG, etc.) without using SQL objects using Native or Pass-thru SQL syntax?

I see some SQL window functions are possible.  For example:

total([Sales (query)].[Sales].[Quantity] for [Sales (query)].[Branch].[Country], [Sales (query)].[Branch].[Province or state], [Sales (query)].[Branch].[City])

...produces...

    SUM("SQ0_Query1"."Quantity")
        OVER(
            PARTITION BY
                "SQ0_Query1"."Country",
                "SQ0_Query1"."Province_or_state",
                "SQ0_Query1"."City"
        ) AS "Quantity1"


...but I can't see how to use LEAD and LAG.

Alternatively, is there a way to configure a data item expression (not the whole query) as pass-thru?