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
RobbyLorenz3004
Regular Visitor

Compare values

Hello everyone,

I have two tables (KPI and KPI_current day. Each table contains the respective date and time. Example: Column A = date and column B = 01:00:00. Column C contains integers. I would now like to compare these values ​​for the respective hour. So how big is the deviation (positive and negative) on the current day compared to the previous day. How can I implement this? Can anyone help me here?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks for the reply from@fahadqadir3, please allow me to provide another insight:

HI,@RobbyLorenz3004 

Regarding the issue you raised, my solution is as follows:

1.First I have created the following table and the column names and data are the data you have given:

vlinyulumsft_0-1720166100043.png

2. Below are the measure I've created for your needs:

 

Measure = 
var predate=SUM('Table'[date])-1
var prevalue=CALCULATE(SUM('Table'[values]),FILTER(ALLSELECTED('Table'),'Table'[date]=predate&&'Table'[time]=MAX('Table'[time])))
RETURN SUM('Table'[values])-prevalue

 

3.Here's my final result, which I hope meets your requirements.

 

vlinyulumsft_1-1720166146086.png

 

 

Please find the attached pbix relevant to the case.

 

Best Regards,

Leroy Lu

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

3 REPLIES 3
fahadqadir3
Super User
Super User

@RobbyLorenz3004 Review the attached screenshot, i create a sample dataset with date and time column. I calculate the previous day value for same time.

fahadqadir3_0-1719922278781.png

 

PreviousDayValue = 
CALCULATE(
MAX('Table'[value]),
FILTER(
'Table',
'Table'[Date] = EARLIER('Table'[PreviousDay]) &&
'Table'[Time] = EARLIER('Table'[Time])
)
)
PreviousDay = 'Table'[Date] - 1

Hope it works.

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!! 

Hallo, zunächst einmal vielen Dank. Ich habe das Datum 07.01.2024 in einer Spalte, dann 07.02.2024 usw. In der nächsten Spalte steht dann die Uhrzeit. Ab 00:00:00 - 23:00:00. In der nächsten Spalte befinden sich dann die Werte. In Ihrem Screenshot liegen die Tage und Uhrzeiten nebeneinander. Muss ich es so machen oder gibt es eine andere Möglichkeit, innerhalb meiner Struktur zu bleiben? Zum Beispiel möchte ich den 07/01/2024 08:00 Wert mit dem 07/02/2024 08:00 Wert vergleichen oder die Differenz anzeigen.

Anonymous
Not applicable

Thanks for the reply from@fahadqadir3, please allow me to provide another insight:

HI,@RobbyLorenz3004 

Regarding the issue you raised, my solution is as follows:

1.First I have created the following table and the column names and data are the data you have given:

vlinyulumsft_0-1720166100043.png

2. Below are the measure I've created for your needs:

 

Measure = 
var predate=SUM('Table'[date])-1
var prevalue=CALCULATE(SUM('Table'[values]),FILTER(ALLSELECTED('Table'),'Table'[date]=predate&&'Table'[time]=MAX('Table'[time])))
RETURN SUM('Table'[values])-prevalue

 

3.Here's my final result, which I hope meets your requirements.

 

vlinyulumsft_1-1720166146086.png

 

 

Please find the attached pbix relevant to the case.

 

Best Regards,

Leroy Lu

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

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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