Forum Discussion
YOY CHANGE FOR FIRST YEAR
- 1 year ago
Hi zraopingm ,
Thank you for reaching out to the Microsoft Fabric Community forum.
Please follow below steps.
1. Created sample table (Table) with sample data.
2. Created Measure (Total Amount) with below DAX code.
Total Amount = SUM('Table'[TOTAL AMOUNT1])
3. Created visual calculation with below DAX code.
YOY CHANGE =
VAR PrevAmount =
CALCULATE(
[Total Amount],
OFFSET(-1, ORDERBY([Reporting Year]))
)
RETURN
IF(
ISBLANK(PrevAmount),
BLANK(),
[Total Amount] - PrevAmount
)4. Please refer output snap, sample data and attached PBIX file.
If this information is helpful, please “Accept it as a solution” and give a "kudos" to assist other community members in resolving similar issues more efficiently.
Thank you.
Hello zraopingm
try this measure
YOY CHANGE =
VAR CurrentYear = SELECTEDVALUE('Reporting Year'[Year])
VAR PrevYear = CurrentYear - 1
VAR CurrentAmount = [TOTAL AMOUNT]
VAR PrevAmount =
CALCULATE(
[TOTAL AMOUNT],
'Reporting Year'[Year] = PrevYear
)
RETURN
IF(
ISBLANK(PrevAmount),
BLANK(),
CurrentAmount - PrevAmount
)
Thanks,
Pankaj Namekar | LinkedIn
If this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.