Column "source."xxx is invalid in the ORDER BY clause because it is not contained in either an aggregate function or the GROUP BY clause

Hi, I'm following the steps discussed in the link below in order to compare sales orders intake to last year:
Measuring rates of change (metabase.com)

However, when reaching the step " Calculating the month-over-month difference", I'm getting an error message saying:
Column "source.Vorig jaar" is invalid in the ORDER BY clause because it is not contained in either an aggregate function or the GROUP BY clause.

I did many things, but the message still appears.
What am I doing wrong?
Is this a known bug?

Many thanks in advance for the feedback.

This is my query:
SELECT
TOP(1048575) "source"."VPL/SIG" AS "VPL/SIG",
DATEFROMPARTS(
YEAR(
"source"."SalesOrders__via__SalesOrderRecId_2__OrderDate_2"
),
MONTH(
"source"."SalesOrders__via__SalesOrderRecId_2__OrderDate_2"
),
1
) AS "SalesOrders__via__SalesOrderRecId_2__OrderDate",
DATEFROMPARTS(
YEAR("source"."Vorig jaar"),
MONTH("source"."Vorig jaar"),
1
) AS "Vorig jaar",
"source"."sum" AS "sum",
"source"."Verschil" AS "Verschil"
FROM
(
SELECT
"source"."VPL/SIG" AS "VPL/SIG",
"source"."SalesOrders__via__SalesOrderRecId_2__OrderDate" AS "SalesOrders__via__SalesOrderRecId_2__OrderDate",
"source"."Vorig jaar" AS "Vorig jaar",
"source"."sum" AS "sum",
"source"."sum" - "selfjointest20240522 - Vorig jaar"."sum" AS "Verschil",
"selfjointest20240522 - Vorig jaar"."VPL/SIG" AS "selfjointest20240522 - Vorig jaar__VPL/SIG",
"selfjointest20240522 - Vorig jaar"."sum" AS "selfjointest20240522 - Vorig jaar__sum",
"selfjointest20240522 - Vorig jaar"."sum_2" AS "selfjointest20240522 - Vorig jaar__sum_2",
DATEFROMPARTS(
YEAR(
"selfjointest20240522 - Vorig jaar"."SalesOrders__via__SalesOrderRecId__OrderDate"
),
MONTH(
"selfjointest20240522 - Vorig jaar"."SalesOrders__via__SalesOrderRecId__OrderDate"
),
1
) AS "selfjointest20240522 - Vorig jaar__SalesOrders__via_cd0d1d94",
DATEFROMPARTS(
YEAR(
"source"."SalesOrders__via__SalesOrderRecId_2__OrderDate"
),
MONTH(
"source"."SalesOrders__via__SalesOrderRecId_2__OrderDate"
),
1
) AS "SalesOrders__via__SalesOrderRecId_2__OrderDate_2"
FROM
(
SELECT
TOP(1048575) "source"."VPL/SIG" AS "VPL/SIG",
DATEFROMPARTS(
YEAR(
"source"."SalesOrders__via__SalesOrderRecId_2__OrderDate"
),
MONTH(
"source"."SalesOrders__via__SalesOrderRecId_2__OrderDate"
),
1
) AS "SalesOrders__via__SalesOrderRecId_2__OrderDate",
DATEFROMPARTS(
YEAR("source"."Vorig jaar"),
MONTH("source"."Vorig jaar"),
1
) AS "Vorig jaar",
SUM("source"."Verkoop SIG/VPL") AS "sum",
SUM("source"."Marge SIG/VPL") AS "sum_2"
FROM
(
SELECT
TOP(1048575) "source"."VPL/SIG" AS "VPL/SIG",
DATEFROMPARTS(
YEAR(
"source"."SalesOrders__via__SalesOrderRecId_2__OrderDate_2"
),
MONTH(
"source"."SalesOrders__via__SalesOrderRecId_2__OrderDate_2"
),
DAY(
"source"."SalesOrders__via__SalesOrderRecId_2__OrderDate_2"
)
) AS "SalesOrders__via__SalesOrderRecId_2__OrderDate",
DATEFROMPARTS(
YEAR("source"."Vorig jaar"),
MONTH("source"."Vorig jaar"),
DAY("source"."Vorig jaar")
) AS "Vorig jaar",
"source"."Verkoop SIG/VPL" AS "Verkoop SIG/VPL",
"source"."Marge SIG/VPL" AS "Marge SIG/VPL"
FROM
(
SELECT
"dbo"."SalesOrderLines"."SalesOrderRecId" AS "SalesOrderRecId",
"dbo"."SalesOrderLines"."Quantity" AS "Quantity",
"dbo"."SalesOrderLines"."CostPriceFC" AS "CostPriceFC",
"dbo"."SalesOrderLines"."NetPrice" AS "NetPrice",
"dbo"."SalesOrderLines"."NetPrice" * "dbo"."SalesOrderLines"."Quantity" AS "Verkoopprijs",
"dbo"."SalesOrderLines"."CostPriceFC" * "dbo"."SalesOrderLines"."Quantity" AS "Kostprijs",
CASE
WHEN (
"SalesOrders__via__SalesOrderRecId_2"."SalespersonFullName" = 'Katrien De Riek'
)

OR (
                  "SalesOrders__via__SalesOrderRecId_2"."SalespersonFullName" = 'Vanessa De Waele'
                )
                OR (
                  "SalesOrders__via__SalesOrderRecId_2"."SalespersonFullName" = 'Robin Hooge'
                )
                OR (
                  "SalesOrders__via__SalesOrderRecId_2"."SalespersonFullName" = 'Stijn De Smet'
                ) THEN (
                  "dbo"."SalesOrderLines"."CostPriceFC" * "dbo"."SalesOrderLines"."Quantity"
                ) * 1.35
                ELSE "dbo"."SalesOrderLines"."NetPrice" * "dbo"."SalesOrderLines"."Quantity"
              END AS "Verkoop SIG/VPL",
              CASE
                WHEN (
                  "SalesOrders__via__SalesOrderRecId_2"."SalespersonFullName" = 'Katrien De Riek'
                )
                OR (
                  "SalesOrders__via__SalesOrderRecId_2"."SalespersonFullName" = 'Vanessa De Waele'
                )
                OR (
                  "SalesOrders__via__SalesOrderRecId_2"."SalespersonFullName" = 'Robin Hooge'
                )
                OR (
                  "SalesOrders__via__SalesOrderRecId_2"."SalespersonFullName" = 'Stijn De Smet'
                ) THEN (
                  "dbo"."SalesOrderLines"."CostPriceFC" * "dbo"."SalesOrderLines"."Quantity"
                ) * 1.35
                ELSE "dbo"."SalesOrderLines"."NetPrice" * "dbo"."SalesOrderLines"."Quantity"
              END - (
                "dbo"."SalesOrderLines"."CostPriceFC" * "dbo"."SalesOrderLines"."Quantity"
              ) AS "Marge SIG/VPL",
              DATEADD(
                month,
                -12,
                "SalesOrders__via__SalesOrderRecId_2"."OrderDate"
              ) AS "Vorig jaar",
              CASE
                WHEN (
                  "SalesOrders__via__SalesOrderRecId_2"."SalespersonFullName" = 'Katrien De Riek'
                )
                OR (
                  "SalesOrders__via__SalesOrderRecId_2"."SalespersonFullName" = 'Vanessa De Waele'
                )
                OR (
                  "SalesOrders__via__SalesOrderRecId_2"."SalespersonFullName" = 'Robin Hooge'
                )
                OR (
                  "SalesOrders__via__SalesOrderRecId_2"."SalespersonFullName" = 'Stijn De Smet'
                ) THEN 'VPL'
                ELSE 'SIG'
              END AS "VPL/SIG",
              "SalesOrders__via__SalesOrderRecId_2"."SalespersonFullName" AS "SalesOrders__via__SalesOrderRecId_2__SalespersonFullName",
              "SalesOrders__via__SalesOrderRecId_2"."OrderDate" AS "SalesOrders__via__SalesOrderRecId_2__OrderDate",
              DATEFROMPARTS(
                YEAR(
                  "SalesOrders__via__SalesOrderRecId_2"."OrderDate"
                ),
                MONTH(
                  "SalesOrders__via__SalesOrderRecId_2"."OrderDate"
                ),
                DAY(
                  "SalesOrders__via__SalesOrderRecId_2"."OrderDate"
                )
              ) AS "SalesOrders__via__SalesOrderRecId_2__OrderDate_2",
              "SalesOrders__via__SalesOrderRecId_2"."RecId" AS "SalesOrders__via__SalesOrderRecId_2__RecId"
            FROM
              "dbo"."SalesOrderLines"

LEFT JOIN "dbo"."SalesOrders" AS "SalesOrders__via__SalesOrderRecId_2" ON "dbo"."SalesOrderLines"."SalesOrderRecId" = "SalesOrders__via__SalesOrderRecId_2"."RecId"
) AS "source"

GROUP BY
"source"."VPL/SIG",
YEAR(
"source"."SalesOrders__via__SalesOrderRecId_2__OrderDate_2"
),
MONTH(
"source"."SalesOrders__via__SalesOrderRecId_2__OrderDate_2"
),
DAY(
"source"."SalesOrders__via__SalesOrderRecId_2__OrderDate_2"
),
YEAR("source"."Vorig jaar"),
MONTH("source"."Vorig jaar"),
DAY("source"."Vorig jaar"),
"source"."Verkoop SIG/VPL",
"source"."Marge SIG/VPL"

ORDER BY
"source"."VPL/SIG" ASC,
YEAR(
"source"."SalesOrders__via__SalesOrderRecId_2__OrderDate_2"
) ASC,
MONTH(
"source"."SalesOrders__via__SalesOrderRecId_2__OrderDate_2"
) ASC,
DAY(
"source"."SalesOrders__via__SalesOrderRecId_2__OrderDate_2"
) ASC,
"source"."Vorig jaar" ASC,
"source"."Verkoop SIG/VPL" ASC,
"source"."Marge SIG/VPL" ASC
) AS "source"
GROUP BY
"source"."VPL/SIG",
YEAR(
"source"."SalesOrders__via__SalesOrderRecId_2__OrderDate"
),
MONTH(
"source"."SalesOrders__via__SalesOrderRecId_2__OrderDate"
),
YEAR("source"."Vorig jaar"),
MONTH("source"."Vorig jaar")
ORDER BY
"source"."VPL/SIG" ASC,
YEAR(
"source"."SalesOrders__via__SalesOrderRecId_2__OrderDate"
) ASC,
MONTH(
"source"."SalesOrders__via__SalesOrderRecId_2__OrderDate"
) ASC,
YEAR("source"."Vorig jaar") ASC,
MONTH("source"."Vorig jaar") ASC,
"sum" ASC,
"sum_2" ASC
) AS "source"
LEFT JOIN (
SELECT
"source"."VPL/SIG" AS "VPL/SIG",
DATEFROMPARTS(
YEAR(
"source"."SalesOrders__via__SalesOrderRecId__OrderDate"
),
MONTH(
"source"."SalesOrders__via__SalesOrderRecId__OrderDate"
),
1
) AS "SalesOrders__via__SalesOrderRecId__OrderDate",
DATEFROMPARTS(
YEAR("source"."Vorig jaar"),
MONTH("source"."Vorig jaar"),
1
) AS "Vorig jaar",
SUM("source"."Verkoop SIG/VPL") AS "sum",
SUM("source"."Marge SIG/VPL") AS "sum_2"
FROM
(
SELECT
TOP(1048575) "source"."VPL/SIG" AS "VPL/SIG",
DATEFROMPARTS(
YEAR(
"source"."SalesOrders__via__SalesOrderRecId__OrderDate_2"
),
MONTH(
"source"."SalesOrders__via__SalesOrderRecId__OrderDate_2"
),
DAY(
"source"."SalesOrders__via__SalesOrderRecId__OrderDate_2"
)
) AS "SalesOrders__via__SalesOrderRecId__OrderDate",
"source"."Vorig jaar" AS "Vorig jaar",
"source"."Verkoop SIG/VPL" AS "Verkoop SIG/VPL",
"source"."Marge SIG/VPL" AS "Marge SIG/VPL"
FROM
(
SELECT
"dbo"."SalesOrderLines"."SalesOrderRecId" AS "SalesOrderRecId",
"dbo"."SalesOrderLines"."Quantity" AS "Quantity",
"dbo"."SalesOrderLines"."CostPriceFC" AS "CostPriceFC",
"dbo"."SalesOrderLines"."NetPrice" AS "NetPrice",
"dbo"."SalesOrderLines"."NetPrice" * "dbo"."SalesOrderLines"."Quantity" AS "Verkoopprijs",
"dbo"."SalesOrderLines"."CostPriceFC" * "dbo"."SalesOrderLines"."Quantity" AS "Kostprijs",
CASE
WHEN (
"SalesOrders__via__SalesOrderRecId"."SalespersonFullName" = 'Katrien De Riek'
)
OR (
"SalesOrders__via__SalesOrderRecId"."SalespersonFullName" = 'Vanessa De Waele'
)
OR (
"SalesOrders__via__SalesOrderRecId"."SalespersonFullName" = 'Robin Hooge'
)
OR (
"SalesOrders__via__SalesOrderRecId"."SalespersonFullName" = 'Stijn De Smet'
) THEN (
"dbo"."SalesOrderLines"."CostPriceFC" * "dbo"."SalesOrderLines"."Quantity"
) * 1.35
ELSE "dbo"."SalesOrderLines"."NetPrice" * "dbo"."SalesOrderLines"."Quantity"
END AS "Verkoop SIG/VPL",
CASE
WHEN (
"SalesOrders__via__SalesOrderRecId"."SalespersonFullName" = 'Katrien De Riek'
)
OR (
"SalesOrders__via__SalesOrderRecId"."SalespersonFullName" = 'Vanessa De Waele'
)
OR (
"SalesOrders__via__SalesOrderRecId"."SalespersonFullName" = 'Robin Hooge'
)
OR (
"SalesOrders__via__SalesOrderRecId"."SalespersonFullName" = 'Stijn De Smet'
) THEN (
"dbo"."SalesOrderLines"."CostPriceFC" * "dbo"."SalesOrderLines"."Quantity"
) * 1.35
ELSE "dbo"."SalesOrderLines"."NetPrice" * "dbo"."SalesOrderLines"."Quantity"
END - (
"dbo"."SalesOrderLines"."CostPriceFC" * "dbo"."SalesOrderLines"."Quantity"
) AS "Marge SIG/VPL",
DATEADD(
month,
-12,
"SalesOrders__via__SalesOrderRecId"."OrderDate"
) AS "Vorig jaar",
CASE
WHEN (
"SalesOrders__via__SalesOrderRecId"."SalespersonFullName" = 'Katrien De Riek'
)
OR (
"SalesOrders__via__SalesOrderRecId"."SalespersonFullName" = 'Vanessa De Waele'
)
OR (
"SalesOrders__via__SalesOrderRecId"."SalespersonFullName" = 'Robin Hooge'
)
OR (
"SalesOrders__via__SalesOrderRecId"."SalespersonFullName" = 'Stijn De Smet'
) THEN 'VPL'
ELSE 'SIG'
END AS "VPL/SIG",
"SalesOrders__via__SalesOrderRecId"."SalespersonFullName" AS "SalesOrders__via__SalesOrderRecId__SalespersonFullName",
"SalesOrders__via__SalesOrderRecId"."OrderDate" AS "SalesOrders__via__SalesOrderRecId__OrderDate",
DATEFROMPARTS(
YEAR("SalesOrders__via__SalesOrderRecId"."OrderDate"),
MONTH("SalesOrders__via__SalesOrderRecId"."OrderDate"),
DAY("SalesOrders__via__SalesOrderRecId"."OrderDate")
) AS "SalesOrders__via__SalesOrderRecId__OrderDate_2",
"SalesOrders__via__SalesOrderRecId"."RecId" AS "SalesOrders__via__SalesOrderRecId__RecId"
FROM
"dbo"."SalesOrderLines"
LEFT JOIN "dbo"."SalesOrders" AS "SalesOrders__via__SalesOrderRecId" ON "dbo"."SalesOrderLines"."SalesOrderRecId" = "SalesOrders__via__SalesOrderRecId"."RecId"
) AS "source"
GROUP BY
"source"."VPL/SIG",
YEAR(
"source"."SalesOrders__via__SalesOrderRecId__OrderDate_2"
),
MONTH(
"source"."SalesOrders__via__SalesOrderRecId__OrderDate_2"
),
DAY(
"source"."SalesOrders__via__SalesOrderRecId__OrderDate_2"
),
"source"."Vorig jaar",
"source"."Verkoop SIG/VPL",
"source"."Marge SIG/VPL"
ORDER BY
"source"."VPL/SIG" ASC,
YEAR(
"source"."SalesOrders__via__SalesOrderRecId__OrderDate_2"
) ASC,
MONTH(
"source"."SalesOrders__via__SalesOrderRecId__OrderDate_2"
) ASC,
DAY(
"source"."SalesOrders__via__SalesOrderRecId__OrderDate_2"
) ASC,
"source"."Vorig jaar" ASC,
"source"."Verkoop SIG/VPL" ASC,
"source"."Marge SIG/VPL" ASC
) AS "source"
GROUP BY
"source"."VPL/SIG",
YEAR(
"source"."SalesOrders__via__SalesOrderRecId__OrderDate"
),
MONTH(
"source"."SalesOrders__via__SalesOrderRecId__OrderDate"
),
YEAR("source"."Vorig jaar"),
MONTH("source"."Vorig jaar")
) AS "selfjointest20240522 - Vorig jaar" ON DATEFROMPARTS(
YEAR("source"."Vorig jaar"),
MONTH("source"."Vorig jaar"),
1
) = DATEFROMPARTS(
YEAR(
"selfjointest20240522 - Vorig jaar"."SalesOrders__via__SalesOrderRecId__OrderDate"
),
MONTH(
"selfjointest20240522 - Vorig jaar"."SalesOrders__via__SalesOrderRecId__OrderDate"
),
1
)
) AS "source"
GROUP BY
"source"."VPL/SIG",
YEAR(
"source"."SalesOrders__via__SalesOrderRecId_2__OrderDate_2"
),
MONTH(
"source"."SalesOrders__via__SalesOrderRecId_2__OrderDate_2"
),
YEAR("source"."Vorig jaar"),
MONTH("source"."Vorig jaar"),
"source"."sum",
"source"."Verschil"
ORDER BY
"source"."VPL/SIG" ASC,
YEAR(
"source"."SalesOrders__via__SalesOrderRecId_2__OrderDate_2"
) ASC,
MONTH(
"source"."SalesOrders__via__SalesOrderRecId_2__OrderDate_2"
) ASC,
YEAR("source"."Vorig jaar") ASC,
MONTH("source"."Vorig jaar") ASC,
"source"."sum" ASC,
"source"."Verschil" ASC

Is that a GUI or an SQL question? by the looks of it I am guessing a GUI and you are showing us the SQL

If that is the case then can you share a screenshot of the setup. are you loading from a table or from another question as a source?

Also share Admin -> troubleshooting -> Diagnostic info

Hi TonyC

Thanks for your feedback.
I'm trying to generate a question using the GUI.
I tried both loading from a model and loading from another question.

As soon as I add a custom column (as you can see in my screenshot), the error message is showing up. Summarizing doesn't help.

This is the diagnostic info:
{
"browser-info": {
"language": "nl",
"platform": "Win32",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0",
"vendor": "Google Inc."
},
"system-info": {
"file.encoding": "UTF-8",
"java.runtime.name": "OpenJDK Runtime Environment",
"java.runtime.version": "11.0.22+7",
"java.vendor": "Eclipse Adoptium",
"java.vendor.url": "https://adoptium.net/",
"java.version": "11.0.22",
"java.vm.name": "OpenJDK 64-Bit Server VM",
"java.vm.version": "11.0.22+7",
"os.name": "Linux",
"os.version": "5.15.0-105-generic",
"user.language": "en",
"user.timezone": "GMT"
},
"metabase-info": {
"databases": [
"h2",
"sqlserver"
],
"hosting-env": "unknown",
"application-database": "h2",
"application-database-details": {
"database": {
"name": "H2",
"version": "2.1.214 (2022-06-13)"
},
"jdbc-driver": {
"name": "H2 JDBC Driver",
"version": "2.1.214 (2022-06-13)"
}
},
"run-mode": "prod",
"version": {
"date": "2024-03-21",
"tag": "v0.49.1",
"hash": "54ef5e9"
},
"settings": {
"report-timezone": null
}
}
}

Many thanks in advance!

Stacktrace:
:class com.microsoft.sqlserver.jdbc.SQLServerException,
:stacktrace
["com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:259)"
"com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1695)"
"com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:648)"
"com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:567)"
"com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7675)"
"com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:4137)"
"com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:272)"
"com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:246)"
"com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:485)"
"com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:1471)"
"--> driver.sql_jdbc.execute$fn__78978.invokeStatic(execute.clj:556)"
"driver.sql_jdbc.execute$fn__78978.invoke(execute.clj:554)"
"driver.sql_jdbc.execute$execute_statement_or_prepared_statement_BANG_.invokeStatic(execute.clj:569)"
"driver.sql_jdbc.execute$execute_statement_or_prepared_statement_BANG_.invoke(execute.clj:565)"
"driver.sql_jdbc.execute$execute_reducible_query$fn__79061$fn__79062.invoke(execute.clj:699)"
"driver.sql_jdbc.execute$execute_reducible_query$fn__79061.invoke(execute.clj:698)"
"driver.sql_jdbc.execute$fn__78854$fn__78855.invoke(execute.clj:388)"
"driver.sql_jdbc.execute$do_with_resolved_connection.invokeStatic(execute.clj:334)"
"driver.sql_jdbc.execute$do_with_resolved_connection.invoke(execute.clj:317)"
"driver.sql_jdbc.execute$fn__78854.invokeStatic(execute.clj:382)"
"driver.sql_jdbc.execute$fn__78854.invoke(execute.clj:380)"
"driver.sql_jdbc.execute$execute_reducible_query.invokeStatic(execute.clj:692)"
"driver.sql_jdbc.execute$execute_reducible_query.invoke(execute.clj:678)"
"driver.sql_jdbc.execute$execute_reducible_query.invokeStatic(execute.clj:689)"
"driver.sql_jdbc.execute$execute_reducible_query.invoke(execute.clj:678)"
"driver.sql_jdbc$fn__106407.invokeStatic(sql_jdbc.clj:78)"
"driver.sql_jdbc$fn__106407.invoke(sql_jdbc.clj:76)"
"query_processor.context$executef.invokeStatic(context.clj:60)"
"query_processor.context$executef.invoke(context.clj:49)"
"query_processor.context.default$default_runf.invokeStatic(default.clj:44)"
"query_processor.context.default$default_runf.invoke(default.clj:42)"
"query_processor.context$runf.invokeStatic(context.clj:46)"
"query_processor.context$runf.invoke(context.clj:40)"
"query_processor.reducible$identity_qp.invokeStatic(reducible.clj:39)"
"query_processor.reducible$identity_qp.invoke(reducible.clj:36)"
"query_processor.middleware.cache$maybe_return_cached_results$maybe_return_cached_results_STAR___71992.invoke(cache.clj:229)"
"query_processor.middleware.permissions$check_query_permissions$fn__66378.invoke(permissions.clj:140)"
"query_processor.middleware.enterprise$check_download_permissions_middleware$fn__71813.invoke(enterprise.clj:51)"
"query_processor.middleware.enterprise$maybe_apply_column_level_perms_check_middleware$fn__71823.invoke(enterprise.clj:64)"
"query_processor.middleware.mbql_to_native$mbql__GT_native$fn__71255.invoke(mbql_to_native.clj:24)"
"query_processor$fn__73137$combined_post_process__73142$combined_post_process_STAR___73143.invoke(query_processor.clj:262)"
"query_processor$fn__73137$combined_pre_process__73138$combined_pre_process_STAR___73139.invoke(query_processor.clj:259)"
"query_processor.middleware.fetch_source_query$resolve_card_id_source_tables$fn__66475.invoke(fetch_source_query.clj:303)"
"query_processor.middleware.resolve_database_and_driver$resolve_driver_and_database_local_values$fn__71903$fn__71907.invoke(resolve_database_and_driver.clj:77)"
"driver$do_with_driver.invokeStatic(driver.clj:97)"
"driver$do_with_driver.invoke(driver.clj:92)"
"query_processor.middleware.resolve_database_and_driver$resolve_driver_and_database_local_values$fn__71903.invoke(resolve_database_and_driver.clj:76)"
"query_processor.middleware.store$initialize_store$fn__67081$fn__67082.invoke(store.clj:14)"
"query_processor.store$do_with_metadata_provider.invokeStatic(store.clj:169)"
"query_processor.store$do_with_metadata_provider.invoke(store.clj:150)"
"query_processor.store$do_with_metadata_provider.invokeStatic(store.clj:158)"
"query_processor.store$do_with_metadata_provider.invoke(store.clj:150)"
"query_processor.middleware.store$initialize_store$fn__67081.invoke(store.clj:13)"
"query_processor.middleware.resolve_database_and_driver$resolve_database$fn__71900.invoke(resolve_database_and_driver.clj:60)"
"query_processor.middleware.normalize_query$normalize$fn__72205.invoke(normalize_query.clj:38)"
"query_processor.middleware.enterprise$fn__71840$handle_audit_app_internal_queries__71841$fn__71843.invoke(enterprise.clj:96)"
"query_processor.middleware.enterprise$handle_audit_app_internal_queries_middleware$fn__71851.invoke(enterprise.clj:103)"
"query_processor.middleware.constraints$mark_needs_default_userland_constraints$fn__70966.invoke(constraints.clj:104)"
"query_processor.middleware.process_userland_query$process_userland_query$fn__72136.invoke(process_userland_query.clj:156)"
"query_processor.middleware.catch_exceptions$catch_exceptions$fn__72737.invoke(catch_exceptions.clj:171)"
"query_processor.reducible$async_qp$qp_STAR___62625$thunk__62627.invoke(reducible.clj:126)"
"query_processor.reducible$async_qp$qp_STAR___62625.invoke(reducible.clj:132)"
"query_processor.reducible$sync_qp$qp_STAR___62637.doInvoke(reducible.clj:153)"
"query_processor$process_userland_query.invokeStatic(query_processor.clj:402)"
"query_processor$process_userland_query.doInvoke(query_processor.clj:398)"
"query_processor$process_query_and_save_execution_BANG_.invokeStatic(query_processor.clj:416)"
"query_processor$process_query_and_save_execution_BANG_.invoke(query_processor.clj:406)"
"query_processor$process_query_and_save_with_max_results_constraints_BANG_.invokeStatic(query_processor.clj:431)"
"query_processor$process_query_and_save_with_max_results_constraints_BANG_.invoke(query_processor.clj:421)"
"api.dataset$run_query_async$fn__93630.invoke(dataset.clj:79)"
"query_processor.streaming$streaming_response_STAR_$fn__53145$fn__53147.invoke(streaming.clj:168)"
"query_processor.streaming$streaming_response_STAR_$fn__53145.invoke(streaming.clj:167)"
"async.streaming_response$do_f_STAR_.invokeStatic(streaming_response.clj:69)"
"async.streaming_response$do_f_STAR_.invoke(streaming_response.clj:67)"
"async.streaming_response$do_f_async$task__43756.invoke(streaming_response.clj:88)"],
:card_id nil,
:context :ad-hoc,
:error
"Column "source.Vorig jaar" is invalid in the ORDER BY clause because it is not contained in either an aggregate function or the GROUP BY clause.",
:row_count 0,
:running_time 0,
:preprocessed
{:database 3,
:type :query,
:query
{:expressions
{"Verschil"
[:-
[:field "sum" {:base-type :type/Float}]
[:field "selfjointest20240522 - Vorig jaar__sum" {:base-type :type/Float}]]},
:source-metadata
[{:name "VPL/SIG",
:display_name "VPL/SIG",
:base_type :type/Text,
:effective_type :type/Text,
:fingerprint
{:global {:distinct-count 1, :nil% 0},
:type {:type/Text {:percent-json 0, :percent-url 0, :percent-email 0, :percent-state 0, :average-length 3}}},
:field_ref [:field "VPL/SIG" {:base-type :type/Text}]}
{:semantic_type nil,
:table_id 60,
:coercion_strategy nil,
:unit :month,
:name "OrderDate",
:settings nil,
:field_ref
[:field
1213
{:base-type :type/Date,
:temporal-unit :month,
:source-field 3050,
:join-alias "SalesOrders__via__SalesOrderRecId_2"}],
:effective_type :type/DateTime,
:nfc_path nil,
:parent_id nil,
:id 1213,
:display_name "SalesOrderRecId → OrderDate",
:fingerprint
{:global {:distinct-count 118, :nil% 0.0},
:type {:type/DateTime {:earliest "2022-09-06T00:00:00Z", :latest "2024-03-21T00:00:00Z"}}},
:base_type :type/DateTime,
:source_alias "SalesOrders__via__SalesOrderRecId"}
{:name "Vorig jaar",
:display_name "Vorig jaar",
:base_type :type/Date,
:effective_type :type/Date,
:unit :month,
:fingerprint
{:global {:distinct-count 42, :nil% 0},
:type {:type/DateTime {:earliest "2022-09-28T00:00:00+02:00", :latest "2023-01-24T00:00:00+02:00"}}},
:field_ref [:field "Vorig jaar" {:base-type :type/DateTime, :temporal-unit :month}]}
{:name "sum",
:display_name "Som van Verkoop SIG/VPL",
:base_type :type/Float,
:effective_type :type/Float,
:fingerprint
{:global {:distinct-count 28, :nil% 0},
:type
{:type/Number
{:min 40.1895,
:q1 1500.0660000000003,
:q3 108340.28774999994,
:max 1347023.292000001,
:sd 342430.37861889973,
:avg 177359.45445507145}}},
:field_ref [:field "sum" {:base-type :type/Float}]}
{:name "sum_2",
:display_name "selfjointest20240522 - Vorig jaar → Som van Verkoop SIG/VPL",
:base_type :type/Float,
:effective_type :type/Float,
:fingerprint
{:global {:distinct-count 28, :nil% 0},
:type
{:type/Number
{:min 40.1895,
:q1 1500.0660000000003,
:q3 108340.28774999994,
:max 1347023.292000001,
:sd 342430.37861889973,
:avg 177359.45445507145}}},
:source_alias "selfjointest20240522 - Vorig jaar",
:field_ref [:field "sum" {:base-type :type/Float, :join-alias "selfjointest20240522 - Vorig jaar"}]}],
:fields
[[:field "VPL/SIG" {:base-type :type/Text}]
[:field
1213
{:base-type :type/Date,
:source-field 3050,
:temporal-unit :default,
:join-alias "SalesOrders__via__SalesOrderRecId_2"}]
[:field "Vorig jaar" {:base-type :type/DateTime, :temporal-unit :default}]
[:field "sum" {:base-type :type/Float}]
[:field "sum" {:base-type :type/Float, :join-alias "selfjointest20240522 - Vorig jaar"}]
[:expression "Verschil"]],
:source-query
{:breakout
[[:field "VPL/SIG" {:base-type :type/Text}]
[:field 1213 {:base-type :type/Date, :temporal-unit :month, :join-alias "SalesOrders__via__SalesOrderRecId_2"}]
[:field "Vorig jaar" {:base-type :type/DateTime, :temporal-unit :month}]
[:field "sum" {:base-type :type/Float}]
[:field "sum" {:base-type :type/Float, :join-alias "selfjointest20240522 - Vorig jaar"}]],
:source-card-id 57,
:source-metadata
[{:display_name "VPL/SIG",
:semantic_type nil,
:field_ref [:field "VPL/SIG" {:base-type :type/Text}],
:name "VPL/SIG",
:base_type :type/Text,
:effective_type :type/Text,
:fingerprint
{:global {:distinct-count 1, :nil% 0},
:type {:type/Text {:percent-json 0, :percent-url 0, :percent-email 0, :percent-state 0, :average-length 3}}}}
{:description nil,
:semantic_type nil,
:coercion_strategy nil,
:unit :month,
:name "OrderDate",
:settings nil,
:fk_target_field_id nil,
:field_ref
[:field
1213
{:base-type :type/DateTime,
:source-field 3050,
:temporal-unit :month,
:join-alias "SalesOrders__via__SalesOrderRecId_2"}],
:effective_type :type/Date,
:id 1213,
:visibility_type :normal,
:display_name "SalesOrderRecId → OrderDate",
:fingerprint
{:global {:distinct-count 118, :nil% 0},
:type {:type/DateTime {:earliest "2022-09-06T00:00:00Z", :latest "2024-03-21T00:00:00Z"}}},
:base_type :type/Date}
{:display_name "Vorig jaar",
:semantic_type nil,
:field_ref [:field "Vorig jaar" {:base-type :type/DateTime, :temporal-unit :month}],
:name "Vorig jaar",
:base_type :type/Date,
:effective_type :type/Date,
:unit :month,
:fingerprint
{:global {:distinct-count 42, :nil% 0},
:type {:type/DateTime {:earliest "2022-09-28T00:00:00+02:00", :latest "2023-01-24T00:00:00+02:00"}}}}
{:display_name "Som van Verkoop SIG/VPL",
:field_ref [:aggregation 0],
:name "sum",
:base_type :type/Float,
:effective_type :type/Float,
:semantic_type nil,
:fingerprint
{:global {:distinct-count 28, :nil% 0},
:type
{:type/Number
{:min 40.1895,
:q1 1500.0660000000003,
:q3 108340.28774999994,
:max 1347023.292000001,
:sd 342430.37861889973,
:avg 177359.45445507145}}}}
{:display_name "Som van Marge SIG/VPL",
:field_ref [:aggregation 1],
:name "sum_2",
:base_type :type/Float,
:effective_type :type/Float,
:semantic_type nil,
:fingerprint
{:global {:distinct-count 28, :nil% 0},
:type
{:type/Number
{:min 10.419500000000003,
:q1 459.11850000000015,
:q3 28088.222750000008,
:max 659659.8419999998,
:sd 135741.70134040748,
:avg 57589.708222214256}}}}],
:order-by
[[:asc [:field "VPL/SIG" {:base-type :type/Text}]]
[:asc
[:field 1213 {:base-type :type/Date, :temporal-unit :month, :join-alias "SalesOrders__via__SalesOrderRecId_2"}]]
[:asc [:field "Vorig jaar" {:base-type :type/DateTime, :temporal-unit :month}]]
[:asc [:field "sum" {:base-type :type/Float}]]],
:joins
[{:alias "selfjointest20240522 - Vorig jaar",
:strategy :left-join,
:condition
[:=
[:field "Vorig jaar" {:base-type :type/DateTime, :temporal-unit :month}]
[:field 1213 {:base-type :type/Date, :temporal-unit :month, :join-alias "selfjointest20240522 - Vorig jaar"}]],
:source-card-id 57,
:source-query
{:breakout
[[:field "VPL/SIG" {:base-type :type/Text}]
[:field
1213
{:base-type :type/DateTime,
:source-field 3050,
:temporal-unit :month,
:join-alias "SalesOrders__via__SalesOrderRecId"}]
[:field "Vorig jaar" {:base-type :type/DateTime, :temporal-unit :month}]],
:order-by
[[:asc [:field "VPL/SIG" {:base-type :type/Text}]]
[:asc
[:field 1213 {:base-type :type/Date, :temporal-unit :month, :join-alias "SalesOrders__via__SalesOrderRecId"}]]
[:asc [:field "Vorig jaar" {:base-type :type/DateTime, :temporal-unit :month}]]
[:asc [:aggregation 0]]
[:asc [:aggregation 1]]],
:aggregation
[[:aggregation-options [:sum [:field "Verkoop SIG/VPL" {:base-type :type/Float}]] {:name "sum"}]
[:aggregation-options [:sum [:field "Marge SIG/VPL" {:base-type :type/Float}]] {:name "sum_2"}]],
:source-card-id 56,
:source-metadata
[{:display_name "VPL/SIG",
:field_ref [:expression "VPL/SIG" {:base-type :type/Text}],
:name "VPL/SIG",
:base_type :type/Text,
:effective_type :type/Text,
:semantic_type nil,
:fingerprint
{:global {:distinct-count 1, :nil% 0},
:type {:type/Text {:percent-json 0, :percent-url 0, :percent-email 0, :percent-state 0, :average-length 3}}}}
{:description nil,
:semantic_type nil,
:coercion_strategy nil,
:unit :day,
:name "OrderDate",
:settings nil,
:fk_target_field_id nil,
:field_ref
[:field
1213
{:base-type :type/DateTime,
:source-field 3050,
:temporal-unit :day,
:join-alias "SalesOrders__via__SalesOrderRecId"}],
:effective_type :type/Date,
:id 1213,
:visibility_type :normal,
:display_name "SalesOrderRecId → OrderDate",
:fingerprint
{:global {:distinct-count 118, :nil% 0},
:type {:type/DateTime {:earliest "2022-09-06T00:00:00Z", :latest "2024-03-21T00:00:00Z"}}},
:base_type :type/Date}
{:display_name "Vorig jaar",
:field_ref [:expression "Vorig jaar" {:base-type :type/DateTime}],
:name "Vorig jaar",
:base_type :type/DateTime,
:effective_type :type/DateTime,
:semantic_type nil,
:fingerprint
{:global {:distinct-count 42, :nil% 0},
:type {:type/DateTime {:earliest "2022-09-28T00:00:00+02:00", :latest "2023-01-24T00:00:00+02:00"}}}}
{:display_name "Verkoop SIG/VPL",
:field_ref [:expression "Verkoop SIG/VPL" {:base-type :type/Float}],
:name "Verkoop SIG/VPL",
:base_type :type/Float,
:effective_type :type/Float,
:semantic_type nil,
:fingerprint
{:global {:distinct-count 1639, :nil% 0},
:type
{:type/Number
{:min -5731.2,
:q1 42.53016704601491,
:q3 303.40647930864816,
:max 105328.08,
:sd 3291.625843725943,
:avg 583.1198410000001}}}}
{:display_name "Marge SIG/VPL",
:field_ref [:expression "Marge SIG/VPL" {:base-type :type/Float}],
:name "Marge SIG/VPL",
:base_type :type/Float,
:effective_type :type/Float,
:semantic_type nil,
:fingerprint
{:global {:distinct-count 1734, :nil% 0},
:type
{:type/Number
{:min -5731.2,
:q1 -4.448122961052931,
:q3 91.31266075055966,
:max 105328.08,
:sd 2832.0244440406245,
:avg 292.86434599999995}}}}],
:source-query/dataset? true,
:source-query
{:source-table 118,
:expressions
{"Verkoopprijs" [:* [:field 3067 {:base-type :type/Float}] [:field 3056 {:base-type :type/Float}]],
"Kostprijs" [:* [:field 3061 {:base-type :type/Float}] [:field 3056 {:base-type :type/Float}]],
"Verkoop SIG/VPL"
[:case
[[[:or
[:=
[:field 1257 {:base-type :type/Text, :source-field 3050, :join-alias "SalesOrders__via__SalesOrderRecId"}]
[:value
"Katrien De Riek"
{:base_type :type/Text,
:effective_type :type/Text,
:coercion_strategy nil,
:semantic_type :type/Category,
:database_type "nvarchar",
:name "SalespersonFullName"}]]
[:=
[:field 1257 {:base-type :type/Text, :source-field 3050, :join-alias "SalesOrders__via__SalesOrderRecId"}]
[:value
"Vanessa De Waele"
{:base_type :type/Text,
:effective_type :type/Text,
:coercion_strategy nil,
:semantic_type :type/Category,
:database_type "nvarchar",
:name "SalespersonFullName"}]]
[:=
[:field 1257 {:base-type :type/Text, :source-field 3050, :join-alias "SalesOrders__via__SalesOrderRecId"}]
[:value
"Robin Hooge"
{:base_type :type/Text,
:effective_type :type/Text,
:coercion_strategy nil,
:semantic_type :type/Category,
:database_type "nvarchar",
:name "SalespersonFullName"}]]
[:=
[:field 1257 {:base-type :type/Text, :source-field 3050, :join-alias "SalesOrders__via__SalesOrderRecId"}]
[:value
"Stijn De Smet"
{:base_type :type/Text,
:effective_type :type/Text,
:coercion_strategy nil,
:semantic_type :type/Category,
:database_type "nvarchar",
:name "SalespersonFullName"}]]]
[:* [:expression "Kostprijs" {:base-type :type/Float}] 1.35]]]
{:default [:expression "Verkoopprijs" {:base-type :type/Float}]}],
"Marge SIG/VPL"
[:-
[:expression "Verkoop SIG/VPL" {:base-type :type/Float}]
[:expression "Kostprijs" {:base-type :type/Float}]],
"Marge"
[:confused:
[:expression "Marge SIG/VPL" {:base-type :type/Float}]
[:expression "Verkoop SIG/VPL" {:base-type :type/Float}]],
"Marge %"
[:confused:
[:expression "Marge SIG/VPL" {:base-type :type/Float}]
[:expression "Verkoop SIG/VPL" {:base-type :type/Float}]],
"Vorig jaar"
[:datetime-subtract
[:field
1213
{:base-type :type/DateTime,
:source-field 3050,
:temporal-unit :default,
:join-alias "SalesOrders__via__SalesOrderRecId"}]
12
:month],
"VPL/SIG"
[:case
[[[:or
[:=
[:field 1257 {:base-type :type/Text, :source-field 3050, :join-alias "SalesOrders__via__SalesOrderRecId"}]
[:value
"Katrien De Riek"
{:base_type :type/Text,
:effective_type :type/Text,
:coercion_strategy nil,
:semantic_type :type/Category,
:database_type "nvarchar",
:name "SalespersonFullName"}]]
[:=
[:field 1257 {:base-type :type/Text, :source-field 3050, :join-alias "SalesOrders__via__SalesOrderRecId"}]
[:value
"Vanessa De Waele"
{:base_type :type/Text,
:effective_type :type/Text,
:coercion_strategy nil,
:semantic_type :type/Category,
:database_type "nvarchar",
:name "SalespersonFullName"}]]
[:=
[:field 1257 {:base-type :type/Text, :source-field 3050, :join-alias "SalesOrders__via__SalesOrderRecId"}]
[:value
"Robin Hooge"
{:base_type :type/Text,
:effective_type :type/Text,
:coercion_strategy nil,
:semantic_type :type/Category,
:database_type "nvarchar",
:name "SalespersonFullName"}]]
[:=
[:field 1257 {:base-type :type/Text, :source-field 3050, :join-alias "SalesOrders__via__SalesOrderRecId"}]
[:value
"Stijn De Smet"
{:base_type :type/Text,
:effective_type :type/Text,
:coercion_strategy nil,
:semantic_type :type/Category,
:database_type "nvarchar",
:name "SalespersonFullName"}]]]
"VPL"]]
{:default "SIG"}]},
:breakout
[[:expression "VPL/SIG" {:base-type :type/Text}]
[:field
1213
{:base-type :type/DateTime,
:source-field 3050,
:temporal-unit :day,
:join-alias "SalesOrders__via__SalesOrderRecId"}]
[:expression "Vorig jaar" {:base-type :type/DateTime}]
[:expression "Verkoop SIG/VPL" {:base-type :type/Float}]
[:expression "Marge SIG/VPL" {:base-type :type/Float}]],
:order-by
[[:asc [:expression "VPL/SIG" {:base-type :type/Text}]]
[:asc
[:field
1213
{:base-type :type/DateTime,
:source-field 3050,
:temporal-unit :day,
:join-alias "SalesOrders__via__SalesOrderRecId"}]]
[:asc [:expression "Vorig jaar" {:base-type :type/DateTime}]]
[:asc [:expression "Verkoop SIG/VPL" {:base-type :type/Float}]]
[:asc [:expression "Marge SIG/VPL" {:base-type :type/Float}]]],
:joins
[{:alias "SalesOrders__via__SalesOrderRecId",
:strategy :left-join,
:source-table 60,
:condition [:= [:field 3050 nil] [:field 1217 {:join-alias "SalesOrders__via__SalesOrderRecId"}]],
:fk-field-id 3050}]}},
:source-metadata
[{:display_name "VPL/SIG",
:semantic_type nil,
:field_ref [:field "VPL/SIG" {:base-type :type/Text}],
:name "VPL/SIG",
:base_type :type/Text,
:effective_type :type/Text,
:fingerprint
{:global {:distinct-count 1, :nil% 0},
:type {:type/Text {:percent-json 0, :percent-url 0, :percent-email 0, :percent-state 0, :average-length 3}}}}
{:description nil,
:semantic_type nil,
:coercion_strategy nil,
:unit :month,
:name "OrderDate",
:settings nil,
:fk_target_field_id nil,
:field_ref
[:field
1213
{:base-type :type/DateTime,
:source-field 3050,
:temporal-unit :month,
:join-alias "SalesOrders__via__SalesOrderRecId_2"}],
:effective_type :type/Date,
:id 1213,
:visibility_type :normal,
:display_name "SalesOrderRecId → OrderDate",
:fingerprint
{:global {:distinct-count 118, :nil% 0},
:type {:type/DateTime {:earliest "2022-09-06T00:00:00Z", :latest "2024-03-21T00:00:00Z"}}},
:base_type :type/Date}
{:display_name "Vorig jaar",
:semantic_type nil,
:field_ref [:field "Vorig jaar" {:base-type :type/DateTime, :temporal-unit :month}],
:name "Vorig jaar",
:base_type :type/Date,
:effective_type :type/Date,
:unit :month,
:fingerprint
{:global {:distinct-count 42, :nil% 0},
:type {:type/DateTime {:earliest "2022-09-28T00:00:00+02:00", :latest "2023-01-24T00:00:00+02:00"}}}}
{:display_name "Som van Verkoop SIG/VPL",
:field_ref [:aggregation 0],
:name "sum",
:base_type :type/Float,
:effective_type :type/Float,
:semantic_type nil,
:fingerprint
{:global {:distinct-count 28, :nil% 0},
:type
{:type/Number
{:min 40.1895,
:q1 1500.0660000000003,
:q3 108340.28774999994,
:max 1347023.292000001,
:sd 342430.37861889973,
:avg 177359.45445507145}}}}
{:display_name "Som van Marge SIG/VPL",
:field_ref [:aggregation 1],
:name "sum_2",
:base_type :type/Float,
:effective_type :type/Float,
:semantic_type nil,
:fingerprint
{:global {:distinct-count 28, :nil% 0},
:type
{:type/Number
{:min 10.419500000000003,
:q1 459.11850000000015,
:q3 28088.222750000008,
:max 659659.8419999998,
:sd 135741.70134040748,
:avg 57589.708222214256}}}}]}],
:source-query
{:breakout
[[:field "VPL/SIG" {:base-type :type/Text}]
[:field
1213
{:base-type :type/DateTime,
:source-field 3050,
:temporal-unit :month,
:join-alias "SalesOrders__via__SalesOrderRecId_2"}]
[:field "Vorig jaar" {:base-type :type/DateTime, :temporal-unit :month}]],
:order-by
[[:asc [:field "VPL/SIG" {:base-type :type/Text}]]
[:asc
[:field 1213 {:base-type :type/Date, :temporal-unit :month, :join-alias "SalesOrders__via__SalesOrderRecId_2"}]]
[:asc [:field "Vorig jaar" {:base-type :type/DateTime, :temporal-unit :month}]]
[:asc [:aggregation 0]]
[:asc [:aggregation 1]]],
:aggregation
[[:aggregation-options [:sum [:field "Verkoop SIG/VPL" {:base-type :type/Float}]] {:name "sum"}]
[:aggregation-options [:sum [:field "Marge SIG/VPL" {:base-type :type/Float}]] {:name "sum_2"}]],
:source-card-id 56,
:source-metadata
[{:display_name "VPL/SIG",
:field_ref [:expression "VPL/SIG" {:base-type :type/Text}],
:name "VPL/SIG",
:base_type :type/Text,
:effective_type :type/Text,
:semantic_type nil,
:fingerprint
{:global {:distinct-count 1, :nil% 0},
:type {:type/Text {:percent-json 0, :percent-url 0, :percent-email 0, :percent-state 0, :average-length 3}}}}
{:description nil,
:semantic_type nil,
:coercion_strategy nil,
:unit :day,
:name "OrderDate",
:settings nil,
:fk_target_field_id nil,
:field_ref
[:field
1213
{:base-type :type/DateTime,
:source-field 3050,
:temporal-unit :day,
:join-alias "SalesOrders__via__SalesOrderRecId_2"}],
:effective_type :type/Date,
:id 1213,
:visibility_type :normal,
:display_name "SalesOrderRecId → OrderDate",
:fingerprint
{:global {:distinct-count 118, :nil% 0},
:type {:type/DateTime {:earliest "2022-09-06T00:00:00Z", :latest "2024-03-21T00:00:00Z"}}},
:base_type :type/Date}
{:display_name "Vorig jaar",
:field_ref [:expression "Vorig jaar" {:base-type :type/DateTime}],
:name "Vorig jaar",
:base_type :type/DateTime,
:effective_type :type/DateTime,
:semantic_type nil,
:fingerprint
{:global {:distinct-count 42, :nil% 0},
:type {:type/DateTime {:earliest "2022-09-28T00:00:00+02:00", :latest "2023-01-24T00:00:00+02:00"}}}}
{:display_name "Verkoop SIG/VPL",
:field_ref [:expression "Verkoop SIG/VPL" {:base-type :type/Float}],
:name "Verkoop SIG/VPL",
:base_type :type/Float,
:effective_type :type/Float,
:semantic_type nil,
:fingerprint
{:global {:distinct-count 1639, :nil% 0},
:type
{:type/Number
{:min -5731.2,
:q1 42.53016704601491,
:q3 303.40647930864816,
:max 105328.08,
:sd 3291.625843725943,
:avg 583.1198410000001}}}}
{:display_name "Marge SIG/VPL",
:field_ref [:expression "Marge SIG/VPL" {:base-type :type/Float}],
:name "Marge SIG/VPL",
:base_type :type/Float,
:effective_type :type/Float,
:semantic_type nil,
:fingerprint
{:global {:distinct-count 1734, :nil% 0},
:type
{:type/Number
{:min -5731.2,
:q1 -4.448122961052931,
:q3 91.31266075055966,
:max 105328.08,
:sd 2832.0244440406245,
:avg 292.86434599999995}}}}],
:source-query/dataset? true,
:source-query
{:source-table 118,
:expressions
{"Verkoopprijs" [:* [:field 3067 {:base-type :type/Float}] [:field 3056 {:base-type :type/Float}]],
"Kostprijs" [:* [:field 3061 {:base-type :type/Float}] [:field 3056 {:base-type :type/Float}]],
"Verkoop SIG/VPL"
[:case
[[[:or
[:=
[:field 1257 {:base-type :type/Text, :source-field 3050, :join-alias "SalesOrders__via__SalesOrderRecId_2"}]
[:value
"Katrien De Riek"
{:base_type :type/Text,
:effective_type :type/Text,
:coercion_strategy nil,
:semantic_type :type/Category,
:database_type "nvarchar",
:name "SalespersonFullName"}]]
[:=
[:field 1257 {:base-type :type/Text, :source-field 3050, :join-alias "SalesOrders__via__SalesOrderRecId_2"}]
[:value
"Vanessa De Waele"
{:base_type :type/Text,
:effective_type :type/Text,
:coercion_strategy nil,
:semantic_type :type/Category,
:database_type "nvarchar",
:name "SalespersonFullName"}]]
[:=
[:field 1257 {:base-type :type/Text, :source-field 3050, :join-alias "SalesOrders__via__SalesOrderRecId_2"}]
[:value
"Robin Hooge"
{:base_type :type/Text,
:effective_type :type/Text,
:coercion_strategy nil,
:semantic_type :type/Category,
:database_type "nvarchar",
:name "SalespersonFullName"}]]
[:=
[:field 1257 {:base-type :type/Text, :source-field 3050, :join-alias "SalesOrders__via__SalesOrderRecId_2"}]
[:value
"Stijn De Smet"
{:base_type :type/Text,
:effective_type :type/Text,
:coercion_strategy nil,
:semantic_type :type/Category,
:database_type "nvarchar",
:name "SalespersonFullName"}]]]
[:* [:expression "Kostprijs" {:base-type :type/Float}] 1.35]]]
{:default [:expression "Verkoopprijs" {:base-type :type/Float}]}],
"Marge SIG/VPL"
[:- [:expression "Verkoop SIG/VPL" {:base-type :type/Float}] [:expression "Kostprijs" {:base-type :type/Float}]],
"Marge"
[:confused:
[:expression "Marge SIG/VPL" {:base-type :type/Float}]
[:expression "Verkoop SIG/VPL" {:base-type :type/Float}]],
"Marge %"
[:confused:
[:expression "Marge SIG/VPL" {:base-type :type/Float}]
[:expression "Verkoop SIG/VPL" {:base-type :type/Float}]],
"Vorig jaar"
[:datetime-subtract
[:field
1213
{:base-type :type/DateTime,
:source-field 3050,
:temporal-unit :default,
:join-alias "SalesOrders__via__SalesOrderRecId_2"}]
12
:month],
"VPL/SIG"
[:case
[[[:or
[:=
[:field 1257 {:base-type :type/Text, :source-field 3050, :join-alias "SalesOrders__via__SalesOrderRecId_2"}]
[:value
"Katrien De Riek"
{:base_type :type/Text,
:effective_type :type/Text,
:coercion_strategy nil,
:semantic_type :type/Category,
:database_type "nvarchar",
:name "SalespersonFullName"}]]
[:=
[:field 1257 {:base-type :type/Text, :source-field 3050, :join-alias "SalesOrders__via__SalesOrderRecId_2"}]
[:value
"Vanessa De Waele"
{:base_type :type/Text,
:effective_type :type/Text,
:coercion_strategy nil,
:semantic_type :type/Category,
:database_type "nvarchar",
:name "SalespersonFullName"}]]
[:=
[:field 1257 {:base-type :type/Text, :source-field 3050, :join-alias "SalesOrders__via__SalesOrderRecId_2"}]
[:value
"Robin Hooge"
{:base_type :type/Text,
:effective_type :type/Text,
:coercion_strategy nil,
:semantic_type :type/Category,
:database_type "nvarchar",
:name "SalespersonFullName"}]]
[:=
[:field 1257 {:base-type :type/Text, :source-field 3050, :join-alias "SalesOrders__via__SalesOrderRecId_2"}]
[:value
"Stijn De Smet"
{:base_type :type/Text,
:effective_type :type/Text,
:coercion_strategy nil,
:semantic_type :type/Category,
:database_type "nvarchar",
:name "SalespersonFullName"}]]]
"VPL"]]
{:default "SIG"}]},
:breakout
[[:expression "VPL/SIG" {:base-type :type/Text}]
[:field
1213
{:base-type :type/DateTime,
:source-field 3050,
:temporal-unit :day,
:join-alias "SalesOrders__via__SalesOrderRecId_2"}]
[:expression "Vorig jaar" {:base-type :type/DateTime}]
[:expression "Verkoop SIG/VPL" {:base-type :type/Float}]
[:expression "Marge SIG/VPL" {:base-type :type/Float}]],
:order-by
[[:asc [:expression "VPL/SIG" {:base-type :type/Text}]]
[:asc
[:field
1213
{:base-type :type/DateTime,
:source-field 3050,
:temporal-unit :day,
:join-alias "SalesOrders__via__SalesOrderRecId_2"}]]
[:asc [:expression "Vorig jaar" {:base-type :type/DateTime}]]
[:asc [:expression "Verkoop SIG/VPL" {:base-type :type/Float}]]
[:asc [:expression "Marge SIG/VPL" {:base-type :type/Float}]]],
:joins
[{:alias "SalesOrders__via__SalesOrderRecId_2",
:strategy :left-join,
:source-table 60,
:condition [:= [:field 3050 nil] [:field 1217 {:join-alias "SalesOrders__via__SalesOrderRecId_2"}]],
:fk-field-id 3050}]}}},
:limit 1048575,
:metabase.query-processor.middleware.limit/original-limit nil},
:middleware {:js-int-to-string? true, :add-default-userland-constraints? true},
:info
{:executed-by 33,
:context :ad-hoc,
:alias/escaped->original {"SalesOrders__via__SalesOrderRecId_2" "SalesOrders__via__SalesOrderRecId"}}},
:data {:rows , :cols }}

Are you able to upgrade to 49.11? ... I think this relates usually to nested questions so having a lot of levels. but in your case it's just a table joined with itself right?

And if you start clicking the previews here at which stage does it fail