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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
nidhi_ifi
Regular Visitor

Compute total inventory value irrespective of the transactions on any given day

There are X number of items(For eg: A,B,C) being managed in the records of the inventory. For any given date the record in the database is only available for those items that were affected due to sale or purchase transaction. 

nidhi_ifi_0-1597256644402.png

 

The goal is to produce this report for any given date which is the total value of inventory irrespective of any transaction on that day.

nidhi_ifi_1-1597256788317.png

In order to arrive at this it will be necessary to compute value of each item irrespective of the transaction on that date:

nidhi_ifi_2-1597256923396.png

I need help with the dax query to achieve the above goal.

Thanks.

3 REPLIES 3
Anonymous
Not applicable

// If you store everything in
// one table T...
// this will give you the value
// on the last visible day
// in the current context.

[Total Value] =
var __lastVisibleDay =
    MAX( T[Date] )
var __result =
    SUMX(
        VALUES( T[Item] ),
        MAXX(
            TOPN(1,
                CALCULATETABLE(
                    T,
                    T[Date] <= __lastVisibleDay,
                    ALL( T[Date] )
                ),
                T[Date],
                DESC
            ),
            T[Value]
        )
    )
return
    __result

The solution gives the sum of the values for the items whose transactions have taken place on a particular day. It does not include the items that did not have any transactions on that day. The goal is to compute the total value of the inventory covering all items irrespective of whether they were transacted on the given day. Please refer the example from the images.

Anonymous
Not applicable

Just change VALUES( T[Item] ) to ALL( T[Item] ) and you'll get what you want.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.