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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
FrauLehmann
Frequent Visitor

Sum Total is not correct in my measure for a historical inventory

I have a very challenging problem right now with one of my Measures.
I am trying to determine from historical inventory and the value of goods in a warehouse. However, I only have the stock movements of the items available for this. These contain the quantity and only for positive stock movements the current purchase price at the time of the movement.
With my formula I can determine the stocks and prices at the respective time. In the visual of a table these are even correct on the level of the variant / the article. But the total of the table is not correct at the end and the total value of goods is not correct?

 

 

Inventory Value = 
VAR MaxIdWithNonZeroPrice =
    MAXX(
        FILTER(
            StockMovement,
            StockMovement[stockMovementPurchasePrice] <> 0
        ),
        StockMovement[stockMovementId]
    )
VAR Quantity =
CALCULATE(
    SUMX(
        StockMovement,
        StockMovement[stockMovementQuantity]
    )
)
VAR PurchasePrice =
CALCULATE(
    MAX(StockMovement[stockMovementPurchasePrice]),
    FILTER(
    StockMovement,
    StockMovement[stockMovementId] = MaxIdWithNonZeroPrice
    )
)
RETURN
CALCULATE(Quantity * PurchasePrice)

 

 

 

1 ACCEPTED SOLUTION
FrauLehmann
Frequent Visitor

Hi @v-xinruzhu-msft ,

 

thank you so much for your reply!

Yesterday I found a solution for my problem. I could solve it this way:

https://community.fabric.microsoft.com/t5/Desktop/Total-Sum-of-Measure/m-p/3078214

 

Thank you very much!

View solution in original post

2 REPLIES 2
FrauLehmann
Frequent Visitor

Hi @v-xinruzhu-msft ,

 

thank you so much for your reply!

Yesterday I found a solution for my problem. I could solve it this way:

https://community.fabric.microsoft.com/t5/Desktop/Total-Sum-of-Measure/m-p/3078214

 

Thank you very much!

v-xinruzhu-msft
Community Support
Community Support

Hi @FrauLehmann 

You can create a new measure

e.g Measure=SUMX(VALUES(StockMovement[StockMovementId]),[Inventory Value])

Then put the measure to the visual.

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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