← awmium/portfolio
portfolio/sales-analytics-app.mdread-only
---
tags: [fabric, react, dax]
stack: [react, dax, vega]
read: 1 min
---

Sales Analytics App

I rebuilt an eight-page sales report as a Fabric Data App: a React single-page app that queries a Power BI semantic model with DAX and runs embedded in the Fabric portal. The pages are Overview, Performance, Products, Geography, Stores, Pareto, Trend and Seasonality, and Profitability.

How it works

  • Global filtering is exactly two cascading hierarchy slicers, Calendar (Year, Quarter, Month) and Product (Category, Subcategory, Product). Everything else lives in each page’s own filter pane.
  • One grain rule, "slice high, group one level deeper", means slicing a Category drills a composition chart to Subcategory instead of collapsing it to a single bar.
  • The Pareto cumulative share is computed inline in DAX, because the model’s own Pareto measures were a colour string and a percentage that wasn’t order-stable.
  • Fabric’s Vega visual ignores field sort in layered specs, so ordering happens in DAX with ORDER BY and the chart’s sort is set to null.
  • Trend lines use long-format DAX (date, series, value) built with UNION or TOPN plus TREATAS, so one line spec renders every comparison. Compare overlays run on the selected measure, so they share its y-scale.

Why it matters

A report can become an app without losing the model underneath. The semantic model stays the single source of truth, and the app owns the layout and the interaction.

read# Sales Analytics App[ ] sections227 words · 1 min · utf-8 · LFTop