Search code examples
powerbidaxmultiple-columnspowerbi-desktopcalculated-columns

Create a calculated countdown column that evaluates two separate columns


I need to create a new calculated column called "Remaining Points" using DAX. The column needs to evaluate a previous column which is separated from other rows by both "Project Name" and "Sprint" columns. The new column looks at the max points (by project and sprint) and uses that as the initial value. Once points are added to the "Completed Points" column, it would then subtract those completed points from that initial value. Any future "Completed Points" values would be subtracted from the current value. See screenshot for reference!

enter image description here


Solution

  • Remaining Points = 
    VAR _proj = [Project Name]
    VAR _sprint = [Sprint]
    VAR _date = [Dates]
    VAR _tbl_filt = FILTER('Table', [Project Name] = _proj && 
                                    [Sprint] = _sprint &&
                                    [Dates] <= _date )
    VAR _comp_pts = SUMX(_tbl_filt, [Completed Points])
    RETURN [Total Points] - _comp_pts
    

    enter image description here