Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi All,
I want to create a new column "Current Max" like what we did in excel below:
but we can't reference to steps (new columns) created later, is there a way to achieve this in Powe BI?
Thanks.
Solved! Go to Solution.
Just want to follow up on my previous post, rather than add ton of steps and still can't achieve the goal, at the end I just wrote a short python scripts using for loop and while loop then run it in Power Query Editor to add all columns I want.
Not entirely clear on what makes a new max. Any chance you can load some more data that shows exactly what you are looking to accomplish? This can more than likely be done in Powe Query
Hi Nick,
Thanks for your quick response, for clarificaiton:
A New Max is 1 when current SOC is larger than the previous Current Max;
A Deep Cycle is 1 when Current Max is larger than current SOC.
Thanks,
Jeremy
Let's see how this goes. I will attach the pbix file below since this is on done in Power Query. But here's what I did:
if [Index] = 0 then [Array SOC] else List.Max( List.Range(#"Added Index"[Array SOC],0,[Index]),1)
File:
@Anonymous
Hi Nick, one more thing to address, the current solution can't fully achieve the goal since Current Max is also determined by Deep Cycle: if there is a deep cycle = 1 in previous row, the current max should recount, please see my first screen shot.
Deep Cycle is 1 when (Current Max - SOC) > 70. so basically as this achieved, the Current Max should reset.
Thanks again,
Jiaming
For example:
The first apperance of Deep Cycle = 1 is correct, but afterwards Max Till Current Row should be reset to value of SOC, so that there won't be 1 all the way to the end
Wasn't 100% clear to me, but here's what I got.
Also had to account if the index was 0 (since that was the 1st row)
Here's the final table. Made some changes to the Array SOC column so I could see if it was working like I expected. You wouldn't need all these columns and could really compress all these steps into just a few, or even better a function. But left them all there so you could see
PBIX file:
https://1drv.ms/u/s!Amqd8ArUSwDS0ywHNzHBP1ao--Eu
@AnonymousHi Nick,
Thanks for your response, the idea is "Max till Current Row" should be reset to current SOC once there's a deep cycle achieved.
In your solution, it works since row 7 (SOC = 800) is bigger than row 2 (SOC = 700), but if I change the value of row 7 to 600, the deep cycle would not be detected.
There should be a deep cycle = 1 in row 8 since 600-66.17>70.
Thanks again.
Just want to follow up on my previous post, rather than add ton of steps and still can't achieve the goal, at the end I just wrote a short python scripts using for loop and while loop then run it in Power Query Editor to add all columns I want.
Great, thanks a lot.
Jeremy
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
97 | |
82 | |
67 | |
61 |
User | Count |
---|---|
150 | |
120 | |
99 | |
87 | |
68 |