Home Machine Learning Calculating the Earlier Worth in Energy BI | by Salvatore Cagliari | Apr, 2024

Calculating the Earlier Worth in Energy BI | by Salvatore Cagliari | Apr, 2024

0
Calculating the Earlier Worth in Energy BI | by Salvatore Cagliari | Apr, 2024

[ad_1]

Calculating the consumption based mostly on meter information seems to be straightforward. Nevertheless, complicated conditions could be difficult. Let’s see how we are able to remedy this.

When we have now Meter information, like we are able to get from our power or water meters at dwelling, we wish to calculate consumption from these values over time. What could be very easy with one meter could be sophisticated if we have now a number of meters for various areas, values, and so forth. Let’s see how we are able to remedy this in Energy BI.

Picture by Doris Morgan on Unsplash

More often than not, we work with transactional information.

Every row describes one occasion (or transaction) from the supply system.

Then we have now inventory information, just like the variety of items of a particular product in our retailer, which might change over time.

Or we have now meter information, which adjustments over time, like, for instance, the electrical energy meter at dwelling.

Once we wish to calculate the consumption, we order the information by the date and time we obtained the worth from the meter and subtract the present worth from the earlier worth. Et voila, we have now the consumption.

Now think about we have now a number of homes at completely different addresses and with a number of meters in every dwelling.

On this case, we should calculate the earlier worth for every meter and get the proper worth.

This poses some challenges after we should do it in Energy BI.

By the best way, in SQL, we have now some methods to unravel this problem with minimal effort. So, when you have got your information in a relational Database, do it there. It’s a lot simpler.

So, let’s see how we are able to remedy it in Energy BI.

I do it as soon as in Energy Question after which with DAX.

I generate the information from my Date desk to load the lead to a desk with the next SQL Question:

DECLARE @dimId int = 2;
DECLARE @worth decimal(18,5) = RAND() * 12;

INSERT INTO [dbo].[MeterData]
([DateKey]
,[Value]
,[House]
,[Meter])
SELECT [DateKey]
,DATEDIFF(dd, '20000101', [Date]) + (DATEDIFF(dd, '20000101', [Date]) * @worth%@dimId)
,'Home ID ' +…

[ad_2]