Row

Column {data-width=3} ### Total Sales

valueBox(
  scales::dollar(sum(superstore$Sales, na.rm = TRUE)),
  "Total Sales", icon = "fa-dollar-sign"
)
$2,297,201

Column {data-width=3} ### Total Profit

valueBox(
  scales::dollar(sum(superstore$Profit, na.rm = TRUE)),
  "Total Profit", icon = "fa-chart-line"
)
$286,397

Column {data-width=3} ### Total Quantity

valueBox(
  sum(superstore$Quantity, na.rm = TRUE),
  "Total Quantity", icon = "fa-shopping-cart"
)
37873

Column {data-width=3} ### Total Orders

valueBox(
  n_distinct(superstore$`Order ID`),
  "Total Orders", icon = "fa-clipboard-list"
)
5009

Row

Column {data-width=650} ### Yearly Sales by Segment {.chart}

segment_yearly <- superstore %>%
  group_by(Year, Segment) %>%
  summarise(Sales = sum(Sales, na.rm = TRUE), .groups = "drop")

plot_ly(
  segment_yearly,
  x = ~Year,
  y = ~Sales,
  color = ~Segment,
  type = 'scatter',
  mode = 'lines+markers'
) %>%
  layout(
    title = "Yearly Sales by Segment",
    xaxis = list(title = "Year"),
    yaxis = list(title = "Sales")
  )

Column ### Yearly Sales by Product Category {.chart}

category_yearly <- superstore %>%
  group_by(Year, Category) %>%
  summarise(Sales = sum(Sales, na.rm = TRUE), .groups = "drop")

plot_ly(
  category_yearly,
  x = ~Year,
  y = ~Sales,
  color = ~Category,
  type = 'bar'
) %>%
  layout(
    title = "Yearly Sales by Product Category",
    barmode = 'group',
    xaxis = list(title = "Year"),
    yaxis = list(title = "Sales")
  )