Forum Discussion
Consumption calculus (energy)
Hi,
I have this table with the values for energy sensors, that registers the value per hour of each sensor, all values in the same column, identified by the sensor id in the same row. I need to have the consumption of each sensor, that can be then filtered in a visual item by location, type, or date, so this sensor_id column has already a relationship with other tables to define all those fields.
I'm using this formula:
but all it does is finding the maximum and minimum values of all the sensors in the column, and I need the Sum of all the consumption's, I mean, it should find the max and min of each sensor, do the difference, and then sum it up.
Example of the data table:
| Date | Sensor_id | Value |
| 03/05/2021 10:00 | id1 | 550 |
| 03/05/2021 11:00 | id3 | 230 |
| 03/05/2021 12:00 | id2 | 1023 |
| 03/05/2021 13:00 | id5 | 112 |
| 03/05/2021 14:00 | id4 | 765 |
| 03/05/2021 15:00 | id1 | 556 |
| 03/05/2021 16:00 | id3 | 234 |
| 03/05/2021 17:00 | id2 | 1034 |
| 03/05/2021 18:00 | id5 | 115 |
| 03/05/2021 19:00 | id4 | 777 |
| 03/05/2021 20:00 | id1 | 559 |
| 03/05/2021 21:00 | id3 | 238 |
| 03/05/2021 22:00 | id2 | 1056 |
| 03/05/2021 23:00 | id5 | 118 |
| 04/05/2021 00:00 | id4 | 789 |
| 04/05/2021 01:00 | id1 | 650 |
| 04/05/2021 02:00 | id3 | 245 |
| 04/05/2021 03:00 | id2 | 1060 |
| 04/05/2021 04:00 | id5 | 123 |
| 04/05/2021 05:00 | id4 | 790 |
I hope I made it clear for you.
Thank you
Hi, Anonymous
Please check the below picture and the sample pbix file's link down below.
Consumption =IF (ISFILTERED ( 'Table'[Sensor_id] ),CALCULATE (MAX ( 'Table'[Value] ),ALLEXCEPT ( 'Table', 'Table'[Sensor_id], 'Table'[Date] ))- CALCULATE (MIN ( 'Table'[Value] ),ALLEXCEPT ( 'Table', 'Table'[Sensor_id], 'Table'[Date] )))Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
Linkedin: linkedin.com/in/jihwankim1975/
Twitter: twitter.com/Jihwan_JHKIM
3 Replies
- Jihwan_Kim
Super User
Hi, Anonymous
Please check the below picture and the sample pbix file's link down below.
Consumption =IF (ISFILTERED ( 'Table'[Sensor_id] ),CALCULATE (MAX ( 'Table'[Value] ),ALLEXCEPT ( 'Table', 'Table'[Sensor_id], 'Table'[Date] ))- CALCULATE (MIN ( 'Table'[Value] ),ALLEXCEPT ( 'Table', 'Table'[Sensor_id], 'Table'[Date] )))Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
Linkedin: linkedin.com/in/jihwankim1975/
Twitter: twitter.com/Jihwan_JHKIM
- Syndicate_Admin
Administrator
Hello
I have the same doubt, I would like to see the dropbox link, but it does not work.
Could you help me?
Thank you.
- Syndicate_Admin
Administrator
Thank you very much for the answer,
I have another doubt, I would also need to take out the calculation of the consumption by datetime, attached screenshot.
I would appreciate it very much if you could help me.
Greetings.