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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Previous Value by Device & Time

Hello Everybody,

i've spent the whole afternoon with this dataset:

 

mtsDeviceIDcOut
19/10/2020 00:00A16.4
19/10/2020 00:05A16.4
19/10/2020 00:10A16.4
19/10/2020 00:15A16.4
19/10/2020 00:20A16.3
19/10/2020 00:25A16.2
19/10/2020 00:30A16.2
19/10/2020 00:35A16.2
19/10/2020 00:40A16.2
19/10/2020 00:45A16.2
19/10/2020 00:00B16.2
19/10/2020 00:05B16.1
19/10/2020 00:10B16.1
19/10/2020 00:15B16.1
19/10/2020 00:20B16.0
19/10/2020 00:25B16.0
19/10/2020 00:30B15.9
19/10/2020 00:35B15.9
19/10/2020 00:40B15.9
19/10/2020 00:45B15.9

 

That I want to transform in this view

mtsHourDevice Average of cOut  Difference 
19/10/2020 00:00A                         20,72 
19/10/2020 01:00A                         20,70-        0,02
19/10/2020 02:00A                         20,70          0,00
19/10/2020 03:00A                         20,62-        0,08
19/10/2020 04:00A                         20,53-        0,10
19/10/2020 05:00A                         20,58          0,05
19/10/2020 00:00B                         20,57 
19/10/2020 01:00B                         20,54-        0,03
19/10/2020 02:00B                         20,35-        0,19
19/10/2020 03:00B                         20,08-        0,27
19/10/2020 04:00B                         20,57          0,49
19/10/2020 05:00B                         20,66          0,09

 

What I need, in few words, is to have a new column that calculates the Difference between the AVERAGE of cOut (Temperature) between an Hour and another.

If too complicated I can also work on the non-grouped by mtsHour dataset and get a value for a single row so I can aggregate it later.

I've tried a ton of samples but no-one really works.

 

Thank you for your help! Will be very appreciated!

Max

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , not sure how got this avg of 20,

 

Try a new column

calculate(lastnonblankvalue([mtsHour],max(Average of cOut)),filter(table, [Device] = earlier([Device]) && [mtsHour] <earlier([mtsHour])))

 

or new measure

calculate(lastnonblankvalue([mtsHour],max(Average of cOut)),filter(allselected(table), [Device] = max([Device]) && [mtsHour] <max([mtsHour])))

View solution in original post

2 REPLIES 2
v-easonf-msft
Community Support
Community Support

Hi, @Anonymous 
Could you please tell me whether your problem has been solved?
If it is,  please mark the helpful replies or add your reply as Answered to close this thread.
It will help other community members easily find the solution when they get the similar issue.
For now, there is no content of description in the thread. If you still need help, please share more details to us.

 

Best Regards,
Community Support Team _ Eason

amitchandak
Super User
Super User

@Anonymous , not sure how got this avg of 20,

 

Try a new column

calculate(lastnonblankvalue([mtsHour],max(Average of cOut)),filter(table, [Device] = earlier([Device]) && [mtsHour] <earlier([mtsHour])))

 

or new measure

calculate(lastnonblankvalue([mtsHour],max(Average of cOut)),filter(allselected(table), [Device] = max([Device]) && [mtsHour] <max([mtsHour])))

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.