Episerver Commerce Report: Sales by day

 We have an option TimeRangesInDays that generate reports, for example 30, 90, or 180 days.

https://docs.developers.optimizely.com/customized-commerce/docs/option-configuration-classes
 
So when you run the job "Collect Order Data for Reports" it will update order data based on TimeRangesInDays to the table OrderReportData, then that data will be used in procedure [ecf_OrderReportData_AggregateByDay] when you generate the report

 
 
In case you want to change the sort order, you can modify the procedure with OrderCreated DESC
ALTER PROCEDURE [dbo].[ecf_OrderReportData_AggregateByDay] 
@TimeZoneOffset DECIMAL(38, 9) = 0 
AS 
BEGIN 
SELECT 
CONVERT(DATE, DATEADD(minute, @TimeZoneOffset, OrderCreated)) AS OrderCreated, 
MarketId, 
Currency, 
Site, 
COUNT(OrderGroupId) AS NumOfOrders, 
SUM(TotalQuantity) AS NumOfItems, 
SUM(TaxTotal) AS TaxTotal, 
SUM(ShippingTotal) as ShippingTotal, 
SUM(HandlingTotal) as HandlingTotal, 
SUM(TotalDiscountAmount) AS DiscountsTotal, 
SUM(SubTotal) AS SubTotal, 
SUM(Total) AS Total 
FROM OrderReportData 
GROUP BY CONVERT(DATE, DATEADD(minute, @TimeZoneOffset, OrderCreated)), MarketId, Currency, Site 
ORDER BY OrderCreated DESC, MarketId, Currency, Site -- Newest orders first 
END
 Here is the result:






Comments

Popular posts from this blog

Optimizely Content Graph: minimal setup for testing

Episerver ServiceAPI: Example of how-to properly call the media upload

SameSite Cookie login troubleshooting