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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
simber
Helper I
Helper I

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 @simber ,

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

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.