Forum Discussion

Peter_Ronaldon's avatar
Peter_Ronaldon
Frequent Visitor
2 years ago
Solved

Need Help - PowerBI Measure

Hi,   I have the following PowerBI Measure:   Price Impact = VAR LY_Sales = ([EXTENDED PRICE SPLY]) VAR CY_Sales = ([Extended Price CY]) VAR LY_Quantity = [BASE QUANTITY SPLY] VAR CY_Quantit...
  • bhanu_gautam's avatar
    2 years ago

    Peter_Ronaldon , Try updated measure

     

    Price Impact =
    VAR LY_Sales = [EXTENDED PRICE SPLY]
    VAR CY_Sales = [Extended Price CY]
    VAR LY_Quantity = [BASE QUANTITY SPLY]
    VAR CY_Quantity = [Base Quantity CY]
    VAR LY_Price_Per_Unit = [LY_Price_Per_Unit]
    VAR CY_Price_Per_Unit = [CY_Price_Per_Unit]

    RETURN
    IF(
    ISBLANK(CY_Quantity),
    0,
    IF(
    ISBLANK(LY_Sales) && ISBLANK(CY_Sales),
    0,
    IF(
    ISBLANK(LY_Sales) || LY_Quantity = 0,
    IF(
    NOT ISBLANK(CY_Price_Per_Unit),
    CY_Price_Per_Unit * LY_Quantity,
    0
    ),
    IF(
    ISBLANK(CY_Sales) || CY_Quantity = 0,
    IF(
    NOT ISBLANK(LY_Price_Per_Unit),
    LY_Price_Per_Unit * LY_Quantity,
    0
    ),
    (CY_Price_Per_Unit - LY_Price_Per_Unit) * LY_Quantity
    )
    )
    )
    )