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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
chotu27
Post Patron
Post Patron

Compare with previous visit and calculate it in Matrix visual

Hi Everyone,

 

In below picture i wanted to compare it with prevous visit and calculate it.

 

Can i know the DAX calculation for it please

 

Example : For ID 1001 Visit2- Visit1 = 22-23 = -1.

 

 

Pre visit.PNG

1 ACCEPTED SOLUTION
Phil_Seamark
Microsoft Employee
Microsoft Employee

HI @chotu27

 

I had some luck with this calculated column and have attached a PBIX file at the bottom.

 

Column = 
VAR VisitNumber = INT(MID('Table1'[Memory],7,99))
VAR LastValue = MAXX(FilTER('Table1','Table1'[Memory] = "Visit " & VisitNumber-1 && 'Table1'[ID] = EARLIER('Table1'[ID])),'Table1'[Value])
RETURN IF(NOT ISBLANK(LastValue),'Table1'[Value] - LastValue) 

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

1 REPLY 1
Phil_Seamark
Microsoft Employee
Microsoft Employee

HI @chotu27

 

I had some luck with this calculated column and have attached a PBIX file at the bottom.

 

Column = 
VAR VisitNumber = INT(MID('Table1'[Memory],7,99))
VAR LastValue = MAXX(FilTER('Table1','Table1'[Memory] = "Visit " & VisitNumber-1 && 'Table1'[ID] = EARLIER('Table1'[ID])),'Table1'[Value])
RETURN IF(NOT ISBLANK(LastValue),'Table1'[Value] - LastValue) 

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors