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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
CRN
Helper I
Helper I

Start and end of period inventory by slicer values

Hi all,

 

I'm trying to figure out a way to calculate the starting and ending inventory. Data of inventory is transactions (Item Ledger Entries from Business Central) as shown below.

CRN_0-1667896466308.png

I wan't to be able to slice the dates for a given period.

CRN_1-1667896771818.png

 

Then by the values of the slicer i need to calculate the sum of quantity until the first date of the slicer (SOP).

Further i need to calculate the sum of quantity until the last date of the slicer (EOP).

I've tried to visualize my request:

CRN_2-1667896821108.png

 

Thanks in advance!

 

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

If you have a Date table linked to your fact table you could use

SOP =
VAR MinDate =
    MIN ( 'Date'[Date] )
RETURN
    CALCULATE (
        SUM ( 'Table'[Qty] ),
        REMOVEFILTERS ( 'Date' ),
        'Date'[Date] < MinDate
    )

EOP =
VAR MaxDate =
    MAX ( 'Date'[Date] )
RETURN
    CALCULATE (
        SUM ( 'Table'[Qty] ),
        REMOVEFILTERS ( 'Date' ),
        'Date'[Date] < MaxDate
    )

View solution in original post

2 REPLIES 2
CRN
Helper I
Helper I

Hi @johnt75,

Thanks for the recommendation! It works perfectly for now! Hopefully I'll be able to figure it out myself as the measure expands.

 

Thanks again!

johnt75
Super User
Super User

If you have a Date table linked to your fact table you could use

SOP =
VAR MinDate =
    MIN ( 'Date'[Date] )
RETURN
    CALCULATE (
        SUM ( 'Table'[Qty] ),
        REMOVEFILTERS ( 'Date' ),
        'Date'[Date] < MinDate
    )

EOP =
VAR MaxDate =
    MAX ( 'Date'[Date] )
RETURN
    CALCULATE (
        SUM ( 'Table'[Qty] ),
        REMOVEFILTERS ( 'Date' ),
        'Date'[Date] < MaxDate
    )

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.