Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Ashish_Mathur
Super User
Super User

Visual calculation measure pattern

Hi,

What would the pattern of a visual calculation measure in a scenario where there is a hierarchy of Year and then Work type in the row labels of a matrix visual.  The objective is to know the amount earned from the same work type in the earlier prior.  Please see expected result column.

  Amount Expected result
2025-26 12 57
Work A 12 23
2024-25 57 77
Work A 23 21
Work B 34 56
2019-20 77  
Work A 21  
Work B 56  

Ashish_Mathur_0-1756372593850.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Ashish_Mathur ,

 

Still working out the use case for the visual calculations but since it's based on the line values and is not like excel exactly I have created the following calculations:

Previous Year (support) = NEXT([Year]) 

Previous Year = IF([Previous Year (support)] = [Year],NEXT( [Previous Year (support)]), [Previous Year (support)])

Value = 
IF(
   ISINSCOPE([Work]),
      LOOKUP([Sum of Amoount], [Work], [Work], [Year], [Previous Year]) , 
      LOOKUP([Sum of Amoount], [Year], [Previous Year])
 )

 

Then hide the Previous Year columns

 

MFelix_0-1756378479810.png

MFelix_2-1756378583625.png

 

 

Hope this helps you get started, has I said still trying some things and we can do more complex calculations for sure but this simple approach works.

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





View solution in original post

4 REPLIES 4
MFelix
Super User
Super User

Hi @Ashish_Mathur ,

 

Still working out the use case for the visual calculations but since it's based on the line values and is not like excel exactly I have created the following calculations:

Previous Year (support) = NEXT([Year]) 

Previous Year = IF([Previous Year (support)] = [Year],NEXT( [Previous Year (support)]), [Previous Year (support)])

Value = 
IF(
   ISINSCOPE([Work]),
      LOOKUP([Sum of Amoount], [Work], [Work], [Year], [Previous Year]) , 
      LOOKUP([Sum of Amoount], [Year], [Previous Year])
 )

 

Then hide the Previous Year columns

 

MFelix_0-1756378479810.png

MFelix_2-1756378583625.png

 

 

Hope this helps you get started, has I said still trying some things and we can do more complex calculations for sure but this simple approach works.

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





Thank you for your help @MFelix 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ashish_Mathur
Super User
Super User

Thank you for replying.  I need to do this using visual calculations (not measures).


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Shahid12523
Community Champion
Community Champion

Expected Result Logic:
For each Work Type and Year in the matrix, return the Amount from the same Work Type in the previous Year.
DAX Pattern Summary:


Expected Result =
CALCULATE(
[Amount],
FILTER(
ALL('DateTable'),
'DateTable'[Year] = SELECTEDVALUE('DateTable'[Year]) - 1
),
FILTER(
ALL('Work'),
'Work'[Work Type] = SELECTEDVALUE('Work'[Work Type])
)
)


This works best in a matrix with Year and Work Type in rows

Shahed Shaikh

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.