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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Kolumam
Post Prodigy
Post Prodigy

Difference between rows in direct query

Hi All,

 

I wanted to calculate the difference between the rows. Is it possible in direct query using power query or calculated column or measure? Please help. See below pic.

Capture.PNG

3 REPLIES 3
Gabriel_Walkman
Continued Contributor
Continued Contributor

I have the same problem and haven't found a solution yet. There's a bunch of solutions for import, but what about directquery?

 

Edit: I'm reading from a postgresql database, and decided to do what I needed with sql before bringing the data to power bi.

 

Gabe

dearwatson
Responsive Resident
Responsive Resident

Hi Koluman

 

Basically you can create 2 index columns and then self-join the columns to get the "previous row" value

then you just subtect them

 

here's a detailed post about ti

https://exceltown.com/en/tutorials/power-bi/powerbi-com-and-power-bi-desktop/power-bi-data-sources/p...

 

Cheers

Greg

"The commonality between science and art is in trying to see profoundly - to develop strategies of seeing and showing." - Edward Tufte

Hello,

 

Your solution doesn't work in direct query. It will work in import mode. Is there any other method? @dearwatson 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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