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! Request 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
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