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,
First time post. I've hit a wall and am looking for some creative ways to overcome it.
I have a formula that needs to reference a prior value, iterating upon itself.
I have a calculated column that provides the initial starting value, then I'd like to add another calculated column for additions for that week, then calculate the fallout ((starting value * weekly additions)*(fallout rate)) using another calculated column for fallout rate. The fallout rate will remain constant for all weeks. The fallout should then be removed from the starting value added to the weekly additions. That ending value should be used as the starting value for the next week. I have consolidated all columns into a single table, however the values must be calculated for the same location and the same model.
See below for the excel version of what I'd like calculated. Real figures first and then the calculations below.
Week | Starting Value | Add (#) | Fallout (%) | Fallout (#) | Ending Total |
6 | 127 | 4.47 | 2.48% | 3.260456 | 128.21 |
7 | 128.209544 | 3.27 | 2.48% | 3.260692691 | 128.22 |
8 | 128.2188513 | 3.27 | 2.48% | 3.260923512 | 128.23 |
9 | 128.2279278 | 3.27 | 2.48% | 3.261148609 | 128.24 |
Week | Starting Value | Add (#) | Fallout (%) | Fallout (#) | Ending Total |
6 | 127 | 4.47 | 2.40% | =(B8+C8)*(D8) | =(B8+C8)-E8 |
7 | =F8 | 3.27 | 2.40% | =(B9+C9)*(D9) | =(B9+C9)-E9 |
8 | =F9 | 3.27 | 2.40% | =(B10+C10)*(D10) | =(B10+C10)-E10 |
9 | =F10 | 3.27 | 2.40% | =(B11+C11)*(D11) | =(B11+C11)-E11 |
Basic Power BI table below:
I've attempted to do this another way to no avail...
My underlying method was as follows:
However when attempting to create the calculated columns that gathered the starts/additions from the prior weeks, it was summing them or leaving them entirely blank for seemingly no reason.
My thoughts behind it was to create the following calculated columns:
Actives/Starting Value
Current Week Starts/Additions
1 Week Prior Starts/Additions
2 Weeks Prior Starts/Additions
3 Weeks Prior Starts/Additions
4 Weeks Prior Starts/Additions
I created a column in the date table entitled "Include Week" that marks the current week as well as the subsequent five "Include" and all others are blanks.
See below for the "3 Weeks Prior" DAX formula I created. Essentially, it is the same formula as for the current week except I'm attempting to pull the data for 21 days prior. The "Actual Date" is always the first date of the week, it's standardized between tables.
My thought was then to create five separate calculated columns, one for summing up each week. I only need five weeks of data at a time, so this would not prove unmanageable at any point.
Week 1 (Current Week):
Solved! Go to Solution.
Thanks for the response. I'll take a look at these!
I'm also beginning to suspect that the issue with my roundabout way of iterating may be due in part to issues with relationships.
Regards,
Quinn
I did not read all of this post because iterating is something DAX hates. Best to do that kind of thing in M code. But, here are some cases where I have sort of solved it.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Runge-Kutta/m-p/411280
https://community.powerbi.com/t5/Community-Blog/Runge-Kutta-and-the-Limits-of-DAX/ba-p/357501
Also, read my articles on "Fun with Graphing with Power BI". I get into some recursion with the fractals.
https://www.linkedin.com/pulse/fun-graphing-power-bi-part-1-greg-deckler-microsoft-mvp-
https://www.linkedin.com/pulse/fun-graphing-power-bi-part-sqrtpowersqrt82-deckler-microsoft-mvp-
https://community.powerbi.com/t5/Community-Blog/Fun-with-Graphing-in-Power-BI-Part-3i/ba-p/365784
Thanks for the response. I'll take a look at these!
I'm also beginning to suspect that the issue with my roundabout way of iterating may be due in part to issues with relationships.
Regards,
Quinn
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 |
---|---|
105 | |
93 | |
75 | |
62 | |
50 |
User | Count |
---|---|
146 | |
109 | |
106 | |
88 | |
61 |