Sample Sales Analysis with Envision

The sample dataset for Envision










Home » Resources » Here

bla bla

here a screenshot example of syntax

[image||{UP}/Products/Envision/aggregating-data.png]

link to the dashboard



Bla bla

why no number of lines, no syntax highlighting and yellow background
/// reads from /input/newdataset
read "/input/newdataset/Lokad_Items.tsv" as Items with
  Brand : text
  Name : text
read "/input/newdataset/Lokad_Orders.tsv" as Orders[Id, Date, *] with
  OrderId : text
  Loc : text

oend := max(Orders.Date)

// Default currency, and currency conversions
when date >= oend - 365
  currency := mode(Orders.Currency)
Orders.NetAmount = forex(Orders.NetAmount, Orders.Currency, currency, Orders.Date)

// KPIs at the top
show label "Sales analysis" a1f1 tomato

when date >= oend - 365
  show summary "Current year" d2f2 tomato with
    sum(Orders.NetAmount) as "Turnover" unit:" \{currency}"
    distinct(Orders.OrderId) as "Orders"
    sum(Orders.Quantity) as "Units"

when date < oend - 365 & date >= oend - 2 * 365
  show summary "Previous year" a2c2 tomato with
    sum(Orders.NetAmount) as "Turnover" unit:" \{currency}"
    distinct(Orders.OrderId) as "Orders"
    sum(Orders.Quantity) as "Units"

// Linecharts
Week.sold := sum(Orders.NetAmount)
when date >= monday(oend) - 52 * 7 & date < monday(oend)
  show linechart "Weekly sales volume" a3f5 tomato unit:" \{currency}" with
    Week.sold as "Current Year"
    Week.sold[-52] as "Previous year"

// Split by brand and by channel
show barchart "Sales per brand" a6c8 tomato unit:" \{currency}" with
  sum(Orders.NetAmount)
  group by Brand
  order by sum(Orders.NetAmount) desc

show barchart "Sales per location" d6f8 tomato unit:" \{currency}" with
  sum(Orders.NetAmount)
  group by Orders.Loc
  order by sum(Orders.NetAmount) desc

// Top sellers, top rising
when date >= oend - 365
  show table "Top sellers (1 year)" a9c11 tomato with
    Id
    Name
    sum(Orders.NetAmount) as "Sold" unit:" \{currency}"
    sum(Orders.Quantity) as "Quantity"
    mode(Orders.Loc) as "Main channel"
    order by sum(Orders.NetAmount) desc

when date >= oend - 30
  show table "Top sellers (1 month)" d9f11 tomato with
    Id
    Name
    sum(Orders.NetAmount) as "Sold" unit:" \{currency}"
    sum(Orders.Quantity) as "Quantity"
    mode(Orders.Loc) as "Main channel"
    order by sum(Orders.NetAmount) desc