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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join 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
Solution Supplier
Solution Supplier

@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
Fabric Data Days is here Carousel

Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.