Lantern Tools

What the Lantern tools told me about a Power BI model in one hour

I have developed Power BI models for years.

You develop and develop, and at some point you lose the picture: the model has grown so large that you do not understand it anymore.

It happened to me with models I had worked on for three years and that other developers had built on since, and I dreaded opening some of them.

The portrait was built for exactly that.

After one hour with it I had found most of the problems in those models and had a plan of action.

The same happened with models other people had created: with the drawing I took the time to understand them and correct them.

This is one such hour, on brume, a synthetic online shop.

brume is a shop I use to build and test. The model was generated from my own modelling patterns by an AI assistant under my brief, which is why I had not built it line by line and did not trust it yet.

The brume model is one of the three sample models on the landing page, and the button below opens it in the tool, so you can open the same drawings and follow along.

Open brume in the tool

The purpose was to understand it well enough to work with it and to know what to improve.

How to read the portrait
The portrait's own key: a dot is a table, a rope is a join with the thick end on the many side, a freckle is a measure, each ring out is one more join away, fact tables sit on the middle disc
The portrait, in its own key.
The portrait's side key: how big is stored data, how thick is key values crossing the join, the ropes are a join, keys finding nothing, flowing both ways, switched off; barnacles are Power Query steps, thorns are calculated columns, an inner ring is incremental refresh
The ropes, and what grew on a table.
The measure lineage's own key: the top row is the tables the measures read, a tile is a measure, each level down is built one measure deeper, a rope means this measure uses that one
The measure lineage, in its own key.

The full key, with the panes and the hands, is on How to read the portrait.

Start with the facts

The portrait of brume: six fact tables on the inner ring, orders one ring out, the dimensions around them, the calculation groups and field parameters on the flank

Six facts sit on the innermost ring: sessions, sales, attribution, and three ad facts at different breakdowns. Orders is a seventh, one ring out, because it filters sales.

From that alone I know what the business is: an online shop with web sessions, orders and ad spend.

I click the facts one by one and open the grain pane for each, to see what the table is about and which tables filter it.

The attribution fact spotlighted, joined to the date and the channel, with its grain pane: ten columns and 4.5k rows, channel key with 9 distinct values, date key with 550, then Shopify orders, GA4 orders and Meta purchases side by side

Attribution draws my eye. What is it?

The grain says it: one row per date and channel, with Shopify orders, GA4 orders and Meta purchases side by side.

It is a table that reconciles three counts of the same thing.

The sessions fact spotlighted with the inner ring of incremental refresh, filtered by the customer, the date, the ad, the country and the channel, a dashed rope to orders, and its grain pane: 35 columns and 799k rows, the incremental refresh note, six keys at the top

Sessions carries the inner ring: incremental refresh. That is good practice for a sessions table.

The ad facts and the order lines could have it too, but at this size it is not needed.

Move to the outer rings

Orders spotlighted: filtered by the customer, the date, the country, the product category and the order age buckets; sales hangs off it

The second ring holds the dimensions that govern the model: age, gender and country for the customer, an acquisition calendar that filters the customer, the ad.

The orders chain is the one to understand.

Age and gender filter the customer, the customer filters orders, orders filter sales, and product filters sales.

Product category filters orders through the order's first product category, and it also filters the ad, so it filters spend.

Here is the first thing I do not agree with. Age filters the customer.

When I look at sales by age, I want the age of the customer at the time of the order, not the age they have now.

The warehouse took this into account, because sales carries its own age range column.

So age should filter sales directly, not the customer.

Gender and country are fine on the customer; those do not change over time, most of the time.

The product category table spotlighted: it filters orders and the ad

One trap for users in that chain: the product category filter looks like revenue per product category.

It is revenue from orders whose main product is in that category.

Stop at the interesting parts

Orders has a switched-off join to sessions on the transaction id, and sessions is also filtered by the customer.

That is a triangle: orders, sessions, customer.

Both ropes into sessions are orange, which means key values cross the join without a match: there are sessions without an order and sessions without a customer, as expected.

The sessions without a customer show up as the blank member in every customer slicer and breakdown. The usual fix is an explicit unknown-customer row in the warehouse.

The join from orders is one to one, so whatever is of interest there can be computed in the warehouse instead.

The join from the customer is one to many, so we can see a customer's sessions.

The question it raises is whether stitching was done in the warehouse.

Stitching means the user pseudo id is tied to the customer id through the orders, so the customer's sessions before the first purchase, and the sessions without a purchase, are backfilled.

Identify improvements

The orders grain pane with the calculated column order_age_bucket open in the DAX pane

There are few Power Query steps, which is good: the processing happens in the database.

There are calculated columns that can move to the warehouse: the order's first product, its first product category, and the order age bucket.

The ad set table spotlighted: the ad joins the ad set, the ad set joins the campaign, three rings out

The ad set and campaign tables are a snowflake off the ad, three rings out.

They do not earn their place. I would keep everything in the ad table.

Understand the calculation groups

The measure lineage of brume: the tables on top, 161 measures in six levels below

I switch to the measure lineage, one level at a time and the down arrow only, because I want to see how things progress and what is built on what.

I was looking for the top tables in the measures and did not find them, so I go back to the portrait and look at the calculation groups. There are eight.

The eight calculation groups drawn as a chain, in precedence order, with their items as dots
The cohort formulas calculation group opened in the DAX pane: six items over the order age buckets

The cohort formulas use the order age bucket table, so that table is not about the customer's age at all.

It is about cohort behaviour since the first order, and it pairs with the group to compute metrics at milestones of a cohort.

The top items filter calculation group opened in the DAX pane: six items, each ranking by a selection parameter and folding the rest into Other

The top items filter uses the top tables and a selection parameter, so a slicer on the page controls how many products show and the rest fold into Other. That is smart.

There is also a lot of use of field parameters, for measures and for dimensions, and I look through them one by one.

Investigate the measures

The spend selector measure spotlighted in the lineage: the three breakdown spends feed it, it feeds the ex layer, and spend stands on that
The DAX of spend_measure_used: the three spends, their minimum, a one percent tolerance, and a SWITCH that returns country, age_gender or placement
The DAX of the selector.

Back in the lineage, the big picture looks healthy. The tree of the ad facts is the interesting one.

Each fact builds its own base measures, and they all feed one spend measure through a selector.

The three facts reconcile to the same spend, so the one with the lower total is the one a filter has touched, and that is the one read.

The other ad metrics work the same way, always through the spend selector.

One warning for whoever builds reports on it: the selector reads one breakdown at a time. A page that filters country and age together gets the lower of the two totals, and the other filter is silently dropped. The report has to say so to business users, or block the combination.

Between the selector and spend there is an ex layer: ex_spend does the switching, and spend only repeats it.

There is no reason for that name. The code belongs in spend, and the ex layer goes.

Find what does not make sense

Projected repeat gross profit spotlighted: it stands on new customers and APRP, and contribution profit stands on it

CAC is as easy as I expected. Contribution profit is the interesting one.

The customer lane computes projected repeat gross profit as new customers times APRP, so we predict how much the new customers will bring.

APRP spotlighted: lifetime repeat profit over lifetime customers, read from the customer table

APRP is the key measure, and it is lifetime repeat profit divided by lifetime customers.

Here I have a problem.

That is the projected repeat profit per new customer averaged over all customers, whether they came years ago or yesterday, and averaging those does not make sense. It is the naive way.

A better way is a threshold, repeat gross profit at six months, one year or two years, and only the last cohorts that have completed that threshold go into APRP.

Lifetime repeat profit spotlighted in the lineage: it reads the customer table, APRP stands on it
The DAX of ltv_repeat_profit: a SUMX over the customer table of the lifetime gross profit minus the lifetime gross profit divided by the lifetime orders
The DAX of lifetime repeat profit.

One level down, lifetime repeat profit is the measure APRP stands on, and I did not understand it at first.

For each customer it takes the lifetime profit and subtracts the lifetime profit divided by the lifetime orders, which is the customer's average profit per order.

Subtracting one average order is the author's way of removing the first order, so what remains is the repeat profit.

The customer table holds only lifetime totals, so the measure guesses that the first order earned the average, and the guess is doing all the work.

It is also not needed: the orders fact already numbers each customer's orders, so the repeat profit is the profit of every order after the first.

Conclusion

I understand the model well enough to work with it, I know what to improve, and I have what to bring to the table.

What is good:

What to improve:

To do this on your own model, export model.bim from Tabular Editor and model.vpax from DAX Studio, two steps each, and drop both on lanternbi.com. The drawing is made in your browser. Nothing is uploaded.

The tool is free to use as many times as you want, and you can take as many snapshots as you like. If you want to download the two views to keep, that costs $4.99 per model, one pack with both views.

Draw your model