This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
Hello,
image 1, is a matrix report with reporting year in column, with 2025 and 2026 year..
rather than using time intelligence, I attempted to use new visual cal. to get the change between years by using image2 formula..
since 2025 is the beginning of the year in this visual, YOY change should be blank.. so i used image 3..
but i got the error message in image 3.. can someone point out where I went wrong?
thank you Zoey
Solved! Go to Solution.
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.
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.
it worked!!! and making sense and I learned a lot.
i have no clue i can use VAR in Visual cal. thank you thank you all!!!
have a great DAX day!!
Hi @zraopingm
Please try this:
Previous Year =
PREVIOUS([Total Revenue], 1, COLUMNS)
YOY =
VAR _PY =
PREVIOUS ( [Total Revenue], 1, COLUMNS )
RETURN
IF ( NOT ( ISBLANK ( _PY ) ), [Total Revenue] - _PY )
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.
Hey @zraopingm ,
Thanks, Zoey! The issue you're facing arises from how you're referencing Reporting Year in your DAX formula using OFFSET and ORDERBY. Let's break this down and fix the issue.
The Core Error
In your third image, the error states: “Reporting Year is not a valid value for the RESET parameter, as it is not present in the visual axes.”
This tells us that while Reporting Year is visible in the matrix, it's not explicitly in the row or column axes of the visual calculation context (especially for OFFSET, which depends on a well-scoped column axis).
Your Current DAX (from Image 2)
YOY CHANGE =
[TOTAL AMOUNT1] -
CALCULATE(
SUM([TOTAL AMOUNT1]),
OFFSET(-1, ORDERBY([Reporting Year]))
)This syntax is almost correct, but OFFSET and ORDERBY only work properly if the column being used ([Reporting Year]) is in the visual axes, and properly scoped for each calculation context.
Fix Approach
You need to add SELECTCOLUMNS and REMOVEFILTERS to better scope the Reporting Year context for the OFFSET function to work correctly.
Try the following revised visual calculation:
YOY CHANGE =
IF(
ISFILTERED('YourDateTable'[Reporting Year]),
[TOTAL AMOUNT1] -
CALCULATE(
SUM([TOTAL AMOUNT1]),
OFFSET(
-1,
ORDERBY('YourDateTable'[Reporting Year]),
PARTITIONBY([DIR IND CODE])
)
)
)Or if you're using a visual calculation in Power BI's Quick Measure interface, try:
YOY CHANGE =
VAR CurrentAmount = [TOTAL AMOUNT1]
VAR PrevAmount =
CALCULATE(
[TOTAL AMOUNT1],
OFFSET(
-1,
ORDERBY('YourDateTable'[Reporting Year]),
PARTITIONBY([DIR IND CODE])
)
)
RETURN
IF(
ISINSCOPE('YourDateTable'[Reporting Year]) &&
NOT ISBLANK(PrevAmount),
CurrentAmount - PrevAmount
)
Things to Remember:
If Still Error:
Ensure:
The matrix uses 'YourDateTable'[Reporting Year] from the proper date dimension table.
You do not use a calculated column like YEAR([Date]) from fact tables.
The column is not renamed in the model, e.g., if it's just "Year" in the model, use that exact name.
If you found this solution helpful, please consider accepting it and giving it a kudos (Like) it’s greatly appreciated and helps others find the solution more easily.
Best Regards,
Nasif Azam
Thank you!
I did use the measure to solve the issue, but at the same time trying to figure this out in visual cal. for learning. this is straight downloaded without date table so I used your idea. and got this error message:.
the goal is yoy change for 2025 should be blank since 2024 is filtered out. If there is no prev. reporting year, then yoy change is zero or blank. Thank you for your time
Thanks again for the thoughtful reply! I really appreciate your goal of learning how to use Visual Calculations effectively instead of defaulting to measures it’s an awesome way to push your DAX skills further.
The Error:
The error in the screenshot says:
"Column reference cannot be used unless it is guaranteed to be unique in the context."
This usually happens because you're using 'DIR IND CODE' inside a visual calculation context without wrapping it properly. Unlike measures where filters are naturally applied, visual calcs need explicit context scoping to resolve columns like this.
Fixing the Visual Calculation:
You’re already using the right idea with OFFSET() and ORDERBY(), but here’s how to fully scope the context:
YOY CHANGE =
VAR CurrentAmount = [TOTAL AMOUNT1]
VAR PrevAmount =
CALCULATE(
[TOTAL AMOUNT1],
OFFSET(
-1,
ORDERBY('YourTableName'[Reporting Year]),
PARTITIONBY('YourTableName'[DIR IND CODE])
)
)
RETURN
IF(
ISINSCOPE('YourTableName'[Reporting Year]) &&
NOT ISBLANK(PrevAmount),
CurrentAmount - PrevAmount
)
Key Fixes:
Wrap [DIR IND CODE] in PARTITIONBY() instead of directly referencing it.
Make sure both Reporting Year and DIR IND CODE come from a single table (not calculated/renamed columns from other tables).
ISINSCOPE() safely blanks out the first year (like 2025) if no previous year exists.
Things to Remember:
If your data doesn't come from a date table, make sure Reporting Year is a numeric or ordered column otherwise ORDERBY() won’t behave as expected.
If TOTAL AMOUNT1 is a measure, you're good. If it's a column, you’ll need to change SUM([TOTAL AMOUNT1]) to match your logic.
If you're still getting errors, try using SELECTCOLUMNS or REMOVEFILTERS to ensure the context is clean.
If you found this solution helpful, please consider accepting it and giving it a kudos (Like) it’s greatly appreciated and helps others find the solution more easily.
Best Regards,
Nasif Azam
Check out the May 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 27 | |
| 26 | |
| 22 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 45 | |
| 42 | |
| 41 | |
| 21 | |
| 18 |