Forum Discussion
Difference between two years showing under both years
- 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
)
Hi kpct56591,
AS per understanding, you are trying to calculate YOY difference in a matrix but it is not showing correct results between 2023 and 2024 columns.
Hope below measure helps you:
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),
CurrentQty - BaseQty2023
)
Define Matrix as below:
Rows - State column
Columns - Ship Date[Year]
Values - Ship Qty and ShipQtyDiffFrom2023
Please let me know if you have further questions. Thanks in advance!
If this reply helped solve your problem, please consider clicking "Accept as Solution" so others can benefit too. And if you found it useful, a quick "Kudos" is always appreciated — thanks!
Best Regards,
Maruthi
Thank you, Maruthi. Your measure works as does the one I posted. It is still showing under both 2023 and 2024 rows. Shown below. I have tried setting the filter to hide ShipQtyDiffFrom2023 if blank, but it then also hides 2023 Ship Qty. Any thoughts?