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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
sTiTcH
Frequent Visitor

Counter comparison between previous values

 have a table of data with the structure below. The table is called 'machines'. The absoluteCount column keeps a tally of the count at the time of the dateTime column. I am trying to figure out how to create a new column with the increase in the count between the current absoluteCount value and the previous absoluteCount value by machineID. There are approximately 50 different machines that are tracked in this table. 

 

With the times being down to the minute, I haven't come up with a good way to do this. Any help or directions would be appreciated.

 

Thanks

 

 

 

dateTimemachineIDabsoluteCount
8/20/2017 0:00machine021146051
8/20/2017 0:00machine01443168
8/20/2017 1:00machine021146051
8/20/2017 1:00machine01443168
8/20/2017 2:00machine021146051
8/20/2017 2:00machine01443168
8/20/2017 3:00machine021146051
8/20/2017 3:00machine01443168
8/20/2017 4:00machine021146051
8/20/2017 4:00machine01443168
8/20/2017 5:00machine021146051
8/20/2017 5:00machine01443168
8/20/2017 6:00machine021146051
8/20/2017 6:00machine01443168
8/20/2017 7:00machine021146051
8/20/2017 7:00machine01443168
8/20/2017 8:00machine021146051
8/20/2017 8:00machine01443168
8/20/2017 9:00machine021146051
8/20/2017 9:00machine01443168
8/20/2017 10:00machine021146051
8/20/2017 10:00machine01443168
8/20/2017 11:00machine021146051
8/20/2017 11:00machine01443168
8/20/2017 12:00machine021146051
8/20/2017 12:00machine01443168
8/20/2017 13:00machine021146051
8/20/2017 13:00machine01443168
8/20/2017 14:00machine021146051
8/20/2017 14:00machine01443168
8/20/2017 15:00machine021146051
8/20/2017 15:00machine01443168
8/20/2017 16:00machine021146051
8/20/2017 16:00machine01443168
8/20/2017 17:00machine021146051
8/20/2017 17:00machine01443168
8/20/2017 18:00machine021146051
8/20/2017 18:00machine01443168
8/20/2017 19:00machine021146051
8/20/2017 19:00machine01443168
8/20/2017 20:00machine021146051
8/20/2017 20:00machine01443168
8/20/2017 21:00machine021146051
8/20/2017 21:00machine01443168
8/20/2017 22:00machine021146051
8/20/2017 22:00machine01443168
8/20/2017 23:00machine021146051
8/20/2017 23:00machine01443168
8/21/2017 0:00machine021146051
8/21/2017 0:00machine01443168
8/21/2017 1:00machine021146051
8/21/2017 1:00machine01443168
8/21/2017 2:00machine021146051
8/21/2017 2:00machine01443168
8/21/2017 3:00machine021146051
8/21/2017 3:00machine01443168
8/21/2017 4:00machine021146051
8/21/2017 4:00machine01443168
8/21/2017 5:00machine021146051
8/21/2017 5:00machine01443168
8/21/2017 6:00machine021146051
8/21/2017 6:00machine01443168
8/21/2017 7:00machine021146057
8/21/2017 7:00machine01443168
8/21/2017 8:00machine021147775
8/21/2017 8:00machine01443168
8/21/2017 9:00machine021150152
8/21/2017 9:00machine01443168
8/21/2017 10:00machine021151552
8/21/2017 10:00machine01443168
8/21/2017 11:00machine021154099
8/21/2017 11:00machine01443168
8/21/2017 12:00machine021156869
8/21/2017 12:00machine01443168
8/21/2017 13:00machine021158234
8/21/2017 13:00machine01443168
8/21/2017 14:00machine021160631
8/21/2017 14:00machine01443168
8/21/2017 15:00machine021160631
8/21/2017 15:00machine01443168
8/21/2017 16:00machine021160631
8/21/2017 16:00machine01443168
8/21/2017 17:00machine021160631
8/21/2017 17:00machine01443168
8/21/2017 18:00machine021160631
8/21/2017 18:00machine01443168
8/21/2017 19:00machine021160631
8/21/2017 19:00machine01443168
8/21/2017 20:00machine021160631
8/21/2017 20:00machine01443168
8/21/2017 21:00machine021160631
8/21/2017 21:00machine01443168
8/21/2017 22:00machine021160631
8/21/2017 22:00machine01443168
8/21/2017 23:00machine021160631
8/21/2017 23:00machine01443168
8/22/2017 0:00machine021160631
8/22/2017 0:00machine01443168
8/22/2017 1:00machine021160631
8/22/2017 1:00machine01443168
8/22/2017 2:00machine021160631
8/22/2017 2:00machine01443168
8/22/2017 3:00machine021160631
8/22/2017 3:00machine01443168
8/22/2017 4:00machine021160631
8/22/2017 4:00machine01443168
8/22/2017 5:00machine021160631
8/22/2017 5:00machine01443168
8/22/2017 6:00machine021160631
8/22/2017 6:00machine01443168
8/22/2017 7:00machine021160637
8/22/2017 7:00machine01443168
8/22/2017 8:00machine021161689
8/22/2017 8:00machine01443168
8/22/2017 9:05machine021164295
8/22/2017 9:05machine01443168
8/22/2017 10:00machine021164878
8/22/2017 10:00machine01443168
8/22/2017 11:00machine021167029
8/22/2017 11:00machine01443168
8/22/2017 12:00machine021169544
8/22/2017 12:00machine01443168
8/22/2017 13:00machine021170464
8/22/2017 13:00machine01443168
8/22/2017 14:00machine021173607
8/22/2017 14:00machine01443168
8/22/2017 15:00machine021175815
8/22/2017 15:00machine01443168
8/22/2017 16:00machine021176001
8/22/2017 16:00machine01443168
8/22/2017 17:00machine021176001
8/22/2017 17:00machine01443168
8/22/2017 18:00machine021176001
8/22/2017 18:00machine01443168
8/22/2017 19:00machine021176001
8/22/2017 19:00machine01443168
8/22/2017 20:00machine021176001
8/22/2017 20:00machine01443168
8/22/2017 21:00machine021176001
8/22/2017 21:00machine01443168
8/22/2017 22:00machine021176001
8/22/2017 22:00machine01443168
8/22/2017 23:00machine021176001
8/22/2017 23:00machine01443168
8/23/2017 0:00machine021176001
8/23/2017 0:00machine01443168
8/23/2017 1:00machine021176001
8/23/2017 1:00machine01443168
8/23/2017 2:00machine021176001
8/23/2017 2:00machine01443168
8/23/2017 3:00machine021176001
8/23/2017 3:00machine01443168
8/23/2017 4:00machine021176001
8/23/2017 4:00machine01443168
8/23/2017 5:00machine021176001
8/23/2017 5:00machine01443168
8/23/2017 6:00machine021176001
8/23/2017 6:00machine01443168
8/23/2017 7:00machine021176007
8/23/2017 7:00machine01443168
8/23/2017 8:01machine021177981
8/23/2017 8:01machine01443168
8/23/2017 9:00machine021180157
8/23/2017 9:00machine01443168
8/23/2017 10:00machine021181738
8/23/2017 10:00machine01449335
8/23/2017 11:00machine021184519
8/23/2017 11:00machine01449335
8/23/2017 12:00machine021186987
8/23/2017 12:00machine01457458

 

 

1 ACCEPTED SOLUTION
sTiTcH
Frequent Visitor

I figred it out with help from other threads.

 

Created a Rank column to index each machineID by date, otherwise it would index the whole table regardless of machineID:

 

Rank =
VAR machineID = table[machineID]
RETURN
RANKX(
FILTER(
ALL(
table),table[machineID]=machineID), table[dateTime],,ASC)

 

 

Get Previous Day Value using the created Rank:

 

PreviousRowValue =
VAR Index = table[Rank] - 1
Return
CALCULATE(
MAX(table[absoluteCount]),
FILTER(ALLEXCEPT(table,table[machineID]),table[Rank] = Index))

 

View solution in original post

1 REPLY 1
sTiTcH
Frequent Visitor

I figred it out with help from other threads.

 

Created a Rank column to index each machineID by date, otherwise it would index the whole table regardless of machineID:

 

Rank =
VAR machineID = table[machineID]
RETURN
RANKX(
FILTER(
ALL(
table),table[machineID]=machineID), table[dateTime],,ASC)

 

 

Get Previous Day Value using the created Rank:

 

PreviousRowValue =
VAR Index = table[Rank] - 1
Return
CALCULATE(
MAX(table[absoluteCount]),
FILTER(ALLEXCEPT(table,table[machineID]),table[Rank] = Index))

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.