Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Sania-F

snapshot calculation

Snapshot is super important in reporting, especially for things like inventory, headcount, or account balances.


🔹 What is a Snapshot?

A snapshot is the value of something at a specific point in time (usually the last day of the month, week, or quarter).
It’s not cumulative and it’s not meant to be summed across days.

👉 Example:

  • If you check your bank balance every day for 10 days:

    • Day 1 = ₹5,000

    • Day 2 = ₹7,000

    • Day 3 = ₹6,500

  • Your "balance" is just one number each day.

  • If you summed them → ₹18,500 (nonsense!).

  • If you take the snapshot on Day 3 → ₹6,500 (correct).


🔹 Snapshot Calculations in Power BI

They are measures where you want to show the state as of the last date in a period, not the sum of all rows.

Typical examples:

  • Inventory Stock on Hand (as of the last date of the month)

  • Employee Headcount (number of employees at month end)

  • Bank Account Balance (balance on last day)


🔹 Why are special DAX patterns needed?

Because in Power BI:

  • By default, dragging a column into Values → SUMs across all rows.

  • For snapshots, that inflates results.

So we use patterns like:

Stock on Hand =
CALCULATE (
    SUM ( Inventory[UnitsBalance] ),
    LASTNONBLANK ( 'Date'[Date], SUM ( Inventory[UnitsBalance] ) )
)

or

Stock on Hand =
CALCULATE (
    SUM ( Inventory[UnitsBalance] ),
    FILTER (
        ALL ( 'Date'[Date] ),
        'Date'[Date] = MAX ( 'Date'[Date] )
    )
)

Both force Power BI to take the balance on the last available date, instead of summing all dates.


In short:
Snapshot calculation = state at a point in time (last date).
Transactional calculation = sum over time (sales, revenue, etc.)

Comments