The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
I need to create the highlighted yellow column in this screenshot (Excel) but in Power BI. The column starts with a known value (story points), subtracts the points per day value, which results in a number and then that "formula" needs repeated down until the answer is 0. Help!
Thanks in advance everyone!
Solved! Go to Solution.
Please try the below code :
Balance =
VAR _MaxIndex =
MAX ( 'Table'[Index] )
VAR _Table =
ADDCOLUMNS (
SUMMARIZE (
'Table',
'Table'[Index],
'Table'[Total Points],
'Table'[Points/Days]
),
"@Cumulative", CALCULATE ( SUM ( 'Table'[Points/Days] ), 'Table'[Index] <= _MaxIndex )
)
VAR _ResultTable =
ADDCOLUMNS (
_Table,
"@Balance",
[Total Points] - [@Cumulative]
+ FIRSTNONBLANKVALUE ( 'Table'[Index], [Points/Days] )
)
RETURN
IF ( HASONEVALUE ( 'Table'[Index] ), SUMX ( _ResultTable, [@Balance] ) )
Please try the below code :
Balance =
VAR _MaxIndex =
MAX ( 'Table'[Index] )
VAR _Table =
ADDCOLUMNS (
SUMMARIZE (
'Table',
'Table'[Index],
'Table'[Total Points],
'Table'[Points/Days]
),
"@Cumulative", CALCULATE ( SUM ( 'Table'[Points/Days] ), 'Table'[Index] <= _MaxIndex )
)
VAR _ResultTable =
ADDCOLUMNS (
_Table,
"@Balance",
[Total Points] - [@Cumulative]
+ FIRSTNONBLANKVALUE ( 'Table'[Index], [Points/Days] )
)
RETURN
IF ( HASONEVALUE ( 'Table'[Index] ), SUMX ( _ResultTable, [@Balance] ) )
User | Count |
---|---|
14 | |
11 | |
8 | |
6 | |
5 |
User | Count |
---|---|
28 | |
19 | |
14 | |
8 | |
5 |