cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Matthias93
Helper III
Helper III

Model battery charge

Editing in order to give it a bump, but as already quite some people have viewed the question without answering I'm starting to wonder if this is possible. Is Power BI suited for this type of calculations? In Excel this would be quite easy.

Hi, I want to model the energy stored in a battery that is connected to solar panel.

If solar power > load, I can charge the battery up to its maximum capacity.
If solar power < load, I can draw energy from the battery down to 0.

I have a measure called excess  that calculates solar power - load (in 15 minute intervals)
Edit: I could make excess a calculated column if that helps.

I now want to create a new measure that calculates for each interval the total energy stored in the battery.
Edit: a calculated column would do as well.

Assume max capacity battery = 1MWh

 

Time Excess (MW)Energy stored (MWh)  
0:000,50,125 0,25 * 0,5 as it is the energy delivered in 15 minutes
0:1510,375 0,25 * 1 + 0,125
0:3010,625 0,25 * 1 + 0,375
0:4521 Topped at 1 as 0,25 * 2 + 0,625 > 1
1:0021 Topped at 1
1:15-10,75 1 - 0,25*1 starting to draw energy
1:30-20,25 0,75 - 0,25*2
1:45-20 Cut at 0 as 0,25 - 2*0,25 < 0
    etc…

 

 I am quite new at BI, so any help would be appreciated.

1 REPLY 1
Greg_Deckler
Super User
Super User

First, where does the .25 come from? Second, I am skeptical that you are going to solve that in DAX. I might play around to confirm, but what I see there essentially requires recursion or looping. DAX really doesn't like recursion. So, you are going to have to solve that in Power Query "M" code. See my series on "Fun with Graphing in Power BI" starting with the 3rd part (Part 3i). You will probably at least need the technique described in the Sierpinski Triangle article:

 

https://www.linkedin.com/pulse/fun-graphing-power-bi-part-3i-greg-deckler-microsoft-mvp-/

 

 

 


@ me in replies or I'll lose your thread!!!
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

Helpful resources

Announcements
August 2022 update 768x460.jpg

Check it Out!

Click here to learn more about the August 2022 updates!

August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors