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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Analitika
Post Prodigy
Post Prodigy

Difference calculation in same table but per different row and tables in Power BI

Hello,

 

I am trying to implement difference calculation. Here is my data table:

Analitika_0-1634194230373.png

My expected result is here:

Analitika_1-1634194259440.png

But I am getting this output which is wrong:

 

Analitika_2-1634194308181.png

0.87!=3289.13

 

Below is DAX query:

Column =
VAR _0 = MAXX(FILTER('x','x'[date]<EARLIER('x'[date]) && 'x'[ID]= EARLIER('x'[ID])),[date])
VAR _1 = MAXX(FILTER('x','x'[date] =_0 && 'x'[ID]= EARLIER('x'[ID]) ),[cre])
return
if('x'[deb] <> 0,_1 - 'x'[deb], blank(

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Analitika ,

 

Please try:

Column = 
VAR _0 = MAXX(FILTER('x', 'x'[ID]= EARLIER('x'[ID])),[date])
VAR _1 = MAXX(FILTER('x','x'[date] =_0 && 'x'[ID]= EARLIER('x'[ID]) ),[CRE])
return
if('x'[DET] <> 0,_1 - 'x'[DET],BLANK())

Eyelyn9_1-1634523048211.pngEyelyn9_2-1634523056862.png

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Analitika ,

 

Please try:

Column = 
VAR _0 = MAXX(FILTER('x', 'x'[ID]= EARLIER('x'[ID])),[date])
VAR _1 = MAXX(FILTER('x','x'[date] =_0 && 'x'[ID]= EARLIER('x'[ID]) ),[CRE])
return
if('x'[DET] <> 0,_1 - 'x'[DET],BLANK())

Eyelyn9_1-1634523048211.pngEyelyn9_2-1634523056862.png

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors