Forum Discussion

kpct56591's avatar
kpct56591
Frequent Visitor
1 year ago
Solved

Difference between two years showing under both years

Hello,   I am trying to have a matrix that displays the YOY difference in quantity shipped. I have a measure that does that, but it displays under both years. How can I remove it from 2023? ...
  • v-echaithra's avatar
    1 year ago

    Hi kpct56591 ,

    Try out this below measure

    ShipQtyDiffFrom2023 =
    VAR ThisYear = SELECTEDVALUE('ofrordx'[Ship Date].[Year])
    VAR CurrentQty = SUM('ofrordx'[Ship Qty])
    VAR BaseQty2023 =
    CALCULATE(
    SUM('ofrordx'[Ship Qty]),
    'ofrordx'[Ship Date].[Year] = 2023
    )
    RETURN
    IF(
    ThisYear > 2023 &&
    NOT ISBLANK(BaseQty2023) &&
    NOT ISBLANK(CurrentQty),
    CurrentQty - BaseQty2023
    )