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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Anonymous
Not applicable

Calculate difference and conditional column between two timeseries tables

Hi,

 

I have two tables where I want to calculate the difference and a conditional column between these tables, which should be filtererable for each category. Which means I want to be able to filter for each key with a slicer.

 

The difference should be between Value 1 and Value 2 for each timestamp.

The conditional calculation compares Value 1 and Value 2 in this way: if Value 1 > Value 2 then 1 else if Value 1<Value2 then -1 else 0

 

The following data is example data, real data consists of more keys and 1-2year of hourly data.

 

Table 1:

Date keyValue 1
2022-01-01 00:00:00 5005
2022-01-01 00:00:00 60010
2022-01-01 01:00:00 5002
2022-01-01 01:00:00 6006

 

Table 2:

Date keyValue 2
2022-01-01 00:00:00 7009
2022-01-01 00:00:00 80015
2022-01-01 01:00:00 70011
2022-01-01 01:00:00 80014

 

Table 3:

KeysTags
500Price 1
600Price 2
700Price 3
800Price 4

 

 

 

2 REPLIES 2
v-luwang-msft
Community Support
Community Support

Hi @Anonymous ,

I see that you have two tables with two values at one point in time, are the two values comparing the sum or?

And what the table3 and keys in two tables work for ?

 

 

 

Best Regards

Lucien

Anonymous
Not applicable

Hi Lucien,

 

For the conditional we compare for each point in time.

So if we filter for key 500 and key 700, we should get:

2022-01-01 00:00:00 -1
2022-01-01 01:00:00 -1

 

The third table is a dimensional table which can be used to connect table 1 and table 2.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.