Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Need help with price effect calculation

Hi, I tried using both calculated column and measure to calculate price impact but it is not returning my desired results.

My goal is to create a visualization with a slicer which would show price impact of product A & B, based on selected period.

Price impact is calcuted as (Price CY - Price PY) * Units CY.

If I create a calculated column, it will return total price impact of 430.

If I create a measure, it will return price impact of 408 (Calculation is done based on total YTD values of A & B)

The correct price impact should be 1,820 - 1,400 = 420. (Pricing impact on YTD values of A & B seperately, then added together)

Any advise wouldbe greatly appreciated

 

Data Model

MonthProductSales CYUnits CYPrice CYSales PYUnits PYPrice PYPrice Impact
1A500020025.0306018017.01,600
1B575025023.0552023024.0-250
2A462021022.0418019022.00
2B460020023.0450018025.0-400
3A575023025.0504021024.0230
3B575025023.0598023026.0-750
 Total314701340 282801220 430

 

Visualization with monthly slicer - selected months 1 to 3

 Sales CYUnits CYPrice CYSales PYUnits PYPrice PYPrice Impact
Product A1537064024.01228058021.21,820
Product B1610070023.01600064025.0-1,400
Total31470134023.528280122023.2408
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Anonymous ,

    Thank you for your kind reply!

    Could you please provide a screenshot of this if it is in excel?

    Thanks for your understanding. Your time and cooperation are much valued by us. We are looking forward to hearing from you to assist further.

    Best regards,

    Lucy Chen

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

8 Replies

  • Hi! I created this measure and came out with 430 for the total: 

    Measure = SUMX('Table',('Table'[Price CY]-'Table'[Price PY])*'Table'[Units CY])
    What the SUMX does is allow the ('Table'[Price CY]-'Table'[Price PY])*'Table'[Units CY]) to be calculated at each row, then it adds all of those values together.
  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    Please check.

    We recommend you to use the code.

    PriceImpact = SUMX('Table', ([Price CY] - 'Table'[Price PY]) * [Units CY])

    Best regards,

    Lucy Chen

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

  • Anonymous's avatar
    Anonymous
    Not applicable

    Thank you all for your solutions! Unfortunately, the correct price impact should be 420 and not 430.

    I guess what I need is a combination of both SUM and SUMX. The calculation should be done at the product level, but should be based on aggregated sales/units of defined period in month slicer.

    This can be done in excel using calculated columns on a sliced pivot table, but I'm not sure how to replicate this in Power BI

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Anonymous ,

      Thank you for your kind reply! Could you tell us why the result is 420 and share your logic with us?

      Thanks for your understanding. Your time and cooperation are much valued by us. We are looking forward to hearing from you to assist further.

      Best regards,

      Lucy Chen

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Lucy,

        Thank you for your prompt response.

        We would get a price impact of 420 if the calculation is done based on YTD Sales/Unit values.

        If we do the calculation based on MTD Sales/Unit values, and then added up the price impact of each month, this would return 430.

         Sales CYUnits CYPrice CYSales PYUnits PYPrice PYPrice Impact
        Product A1537064024.01228058021.21,820
        Product B1610070023.01600064025.0-1,400
        Total314701340 28280122023.2420