Forum Discussion

stuartp22's avatar
stuartp22
New Member
5 years ago
Solved

Calculate average price increase

I've created a Power BI visual to show how the cost prices of products have increased over time.  I have a product table and a purchase order lines table, and have output all purchased products, and ...
  • mahoneypat's avatar
    5 years ago

    The measure you need for your card is likely one like the one below.  Replace Table[ProductID] with the table/column that has your product id or name.  This will create a virtual table of all your products (in scope of any slicers you have), calculate the price increase for each, and then average all those values together.

     

    Avg Product Increase =
    AVERAGEX (
        DISTINCT ( Table[ProductID] ),
        VAR lstcst = [Last Cost]
        VAR frstcst = [First Cost]
        RETURN
            DIVIDE ( lstcst - frstcstfrstcst )
    )

     

    The use of variables prevents it recalculated [First Cost] twice.

     

    Pat