Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
amit_wairkar
Frequent Visitor

Formula required

Hi,

 

I have a following DevOps table. There are two columns that needs to be derived.

  1. Actual Story Points:
    1. For a Sprint if all the User Stories are closed, then the Sprint is completed.  Then the Story point is considered for that User Story.
    2. For a Sprint if any of the User Stories is not closed, then Sprint is Active. Then the Story Point is not considered for any of the User Stories. Therefore the output is Zero.
  2. Average Story Points: It is the average of all the closed Sprints.
ProductWork Item IDSprintWork ItemStatusStory PointsActual Story PointsAverage Story Points
Gift Voucher1Sprint 01User Story 1Closed225
Gift Voucher2Sprint 01User Story 2Closed335
Gift Voucher3Sprint 02User Story 1Closed555
Demo4Sprint 01User Story 1Closed108
Demo5Sprint 01User Story 2Open208
Demo4Sprint 02User Story 1Closed118
Demo5Sprint 02User Story 2Closed228
Demo6Sprint 02User Story 3Closed558
Demo7Sprint 03User Story 1New228
2 ACCEPTED SOLUTIONS
Sergii24
Super User
Super User

Hi @amit_wairkar, so what exactly is your question? What have you tried to do? What is not working? What do you struggle with (hint: everything is not an anwer 😉 ).

Remeber that community is here to help to those who wants to learn, not solving task for you 🙂

View solution in original post

So, first of all you need to understand whether the sprint is active or closed:

 

Sprint Status = 
VAR _CurrentSprint = 'Table'[Sprint]        //capture sprint from a current row
VAR _OpenUserStories =                      //table that contains all rows for current sprint that are not closed, if sprint is closed, this table should be empty
    FILTER(
        'Table',
        'Table'[Sprint] = _CurrentSprint && 'Table'[Status] <> "Closed"
    )
VAR _Result =                               //checking if there are no rows in OpenUserStories. If it's empty, then all items are closed
    IF(
        COUNTROWS( _OpenUserStories ) > 0,
        "Active",
        "Closed"
    )

RETURN _Result

 

 
Once you have it, you can proceed with assigning actual story points:

 

Actual Story Points = IF( 'Table'[Sprint Status] = "Closed", 'Table'[Story Points], 0 )

 

 
Finally you calculate the average of closed stories:

 

Average Story Points = 
VAR _NumberOfClosedStories =                        //filter the table only to closed sprints, summarize it by distinct sprints and count them
    COUNTROWS(
        SUMMARIZE(
            FILTER(
                'Table',
                'Table'[Sprint Status] = "Closed"
            ),
            'Table'[Sprint]
        )
    )
VAR _ActualStoryPointsToConsider =                  //number of actual points to consider
    SUMX(
       FILTER(
            'Table',
            'Table'[Sprint Status] = "Closed"
        ), 
        [Actual Story Points]
    )
VAR _Result =                                       //get the average dividing points by number of closed stories
    DIVIDE( 
        _ActualStoryPointsToConsider, 
        _NumberOfClosedStories 
    )

RETURN _Result


Here is the final result:

Sergii24_0-1726841548997.png

 



Take your time to read carefully the code with the corresponding comments. I'm attaching pbix to make it easier for you. 

If you have difficultires to understand why the code is written in a specific way, make sure to master concepts of "filter context" (Filter context in DAX - SQLBI) and "row context" (Row context in DAX - SQLBI). These are keys to undertand the code. 

Good luck with your project!

 

View solution in original post

3 REPLIES 3
amit_wairkar
Frequent Visitor

@Sergii24 I have tried a lot of formulas to derive the column for Actual Story Points and Average Story Points. But i couldnt get through. So request your help for building the formula.

 

Regards,

Amit

So, first of all you need to understand whether the sprint is active or closed:

 

Sprint Status = 
VAR _CurrentSprint = 'Table'[Sprint]        //capture sprint from a current row
VAR _OpenUserStories =                      //table that contains all rows for current sprint that are not closed, if sprint is closed, this table should be empty
    FILTER(
        'Table',
        'Table'[Sprint] = _CurrentSprint && 'Table'[Status] <> "Closed"
    )
VAR _Result =                               //checking if there are no rows in OpenUserStories. If it's empty, then all items are closed
    IF(
        COUNTROWS( _OpenUserStories ) > 0,
        "Active",
        "Closed"
    )

RETURN _Result

 

 
Once you have it, you can proceed with assigning actual story points:

 

Actual Story Points = IF( 'Table'[Sprint Status] = "Closed", 'Table'[Story Points], 0 )

 

 
Finally you calculate the average of closed stories:

 

Average Story Points = 
VAR _NumberOfClosedStories =                        //filter the table only to closed sprints, summarize it by distinct sprints and count them
    COUNTROWS(
        SUMMARIZE(
            FILTER(
                'Table',
                'Table'[Sprint Status] = "Closed"
            ),
            'Table'[Sprint]
        )
    )
VAR _ActualStoryPointsToConsider =                  //number of actual points to consider
    SUMX(
       FILTER(
            'Table',
            'Table'[Sprint Status] = "Closed"
        ), 
        [Actual Story Points]
    )
VAR _Result =                                       //get the average dividing points by number of closed stories
    DIVIDE( 
        _ActualStoryPointsToConsider, 
        _NumberOfClosedStories 
    )

RETURN _Result


Here is the final result:

Sergii24_0-1726841548997.png

 



Take your time to read carefully the code with the corresponding comments. I'm attaching pbix to make it easier for you. 

If you have difficultires to understand why the code is written in a specific way, make sure to master concepts of "filter context" (Filter context in DAX - SQLBI) and "row context" (Row context in DAX - SQLBI). These are keys to undertand the code. 

Good luck with your project!

 

Sergii24
Super User
Super User

Hi @amit_wairkar, so what exactly is your question? What have you tried to do? What is not working? What do you struggle with (hint: everything is not an anwer 😉 ).

Remeber that community is here to help to those who wants to learn, not solving task for you 🙂

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.