cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MaxEle
New Member

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 IV
Super User IV

@MaxEle , 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])))



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

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

Hi, @MaxEle 
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 IV
Super User IV

@MaxEle , 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])))



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

Top Solution Authors
Top Kudoed Authors