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
nhoff
Advocate I
Advocate I

Compare data/snapshots of data based on log time stamps

I need help with comparing evolution of the same data across different snapshots from a data source. I am simplifying my example.

 

Everyday I get a snapshot of invoice data in a csv file. I import the data in the same table tblInvoice:

 

InvoiceID

InvoiceAmount

InvoiceStatus

LogID

 

Each dataload get a LogID.

 

Consequently I have a Logtable with

 

LogID

LogTimestamp

LogRank = RANK.EQ(Log[LogID],Log[LogID],DESC) --- making sure I always can filter for the latest Log

 

I have some measures, e.g

 

TotalAmount:= Calculate(SUM(tblInvoice[InvoiceAmount]))

InvoiceCount = Calculate(Countrows(tblInvoice))

 

I also have a date table.

 

I want to be able to compare e.g. the relative InvoiceCount between e.g. LogRank 1 and 2. The business value of this is to understand the development in invoice status across time. Any suggestions?

 

 

1 ACCEPTED SOLUTION
Eric_Zhang
Microsoft Employee
Microsoft Employee

@nhoff

 

In my opinion you can create a calculated table to get the rank 1and 2 invoices. Make sure there's a many to one relationship between Invoices and LogTable.

Top2LatestLoadedData = CALCULATETABLE(Invoices,TOPN(2,LogTable,LogTable[LogRank ]))

Then apply your measure against this table.

TotalAmount= Calculate(SUM(Top2LatestLoadedData[InvoiceAmount]))

InvoiceCount = Calculate(Countrows(Top2LatestLoadedData))

View solution in original post

2 REPLIES 2
Eric_Zhang
Microsoft Employee
Microsoft Employee

@nhoff

 

In my opinion you can create a calculated table to get the rank 1and 2 invoices. Make sure there's a many to one relationship between Invoices and LogTable.

Top2LatestLoadedData = CALCULATETABLE(Invoices,TOPN(2,LogTable,LogTable[LogRank ]))

Then apply your measure against this table.

TotalAmount= Calculate(SUM(Top2LatestLoadedData[InvoiceAmount]))

InvoiceCount = Calculate(Countrows(Top2LatestLoadedData))
Vvelarde
Community Champion
Community Champion

hi @nhoff

 

An idea

 

Measure =
VAR LOGRANKER=Max(Logs[LogRank])-1
RETURN
[InvoiceCount]-CALCULATE(Invoices[InvoiceCount];FILTER(all(Logs);Logs[LogRank]=LOGRANKER))




Lima - Peru

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.