The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi All,
I need to build a dynamic column with iterative values as below. I already have "To be added value" and "Inventory Value". Need to build the "Projection" column through dax. Please help on how to get to this result:
Any help would be great. Thanks!
Solved! Go to Solution.
Hello @Vaibhav3008,
If you can add an additional column called "row number", your problem may be solved like this:
Here's the [DAX] code in the text format for convenience:
projection =
VAR current_row_number = [row number]
VAR last_inv_value_index = MAXX ( FILTER ( ALL ( data ), NOT ( ISBLANK ( data[inventory value] ) ) ), [row number] )
VAR base = LOOKUPVALUE ( data[inventory value], data[row number], last_inv_value_index )
VAR surplus = CALCULATE ( SUM ( data[to be added value] ), ALL ( data ), data[row number] > last_inv_value_index, data[row number] <= current_row_number )
VAR result = IF ( ISBLANK( data[inventory value] ), base + surplus, BLANK () )
RETURN result
If a new column is not an option, you will need a more complex solution.
Best Regards,
Alexander
Thanks for the help. It's working!
Hello @Vaibhav3008,
If you can add an additional column called "row number", your problem may be solved like this:
Here's the [DAX] code in the text format for convenience:
projection =
VAR current_row_number = [row number]
VAR last_inv_value_index = MAXX ( FILTER ( ALL ( data ), NOT ( ISBLANK ( data[inventory value] ) ) ), [row number] )
VAR base = LOOKUPVALUE ( data[inventory value], data[row number], last_inv_value_index )
VAR surplus = CALCULATE ( SUM ( data[to be added value] ), ALL ( data ), data[row number] > last_inv_value_index, data[row number] <= current_row_number )
VAR result = IF ( ISBLANK( data[inventory value] ), base + surplus, BLANK () )
RETURN result
If a new column is not an option, you will need a more complex solution.
Best Regards,
Alexander
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
20 | |
18 | |
18 | |
18 | |
14 |
User | Count |
---|---|
40 | |
35 | |
23 | |
20 | |
20 |