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
ray67052
Regular Visitor

Get Count of Change of Statuses Overtime With Snapshot Data

Greetings,

I have a dataset that is a snapshot of each day and I am trying to get a count of the number of times a work item Failed Test. I'm struggling with getting Power BI to count the number of times it changed, all I can seem to achieve is either a total count of the number of times it has appeared in the dataset or a unique count of the failed test status. I've tried various solutions to posts on the forums to no avail 😞

 

Here's my dataset:

Work Item IDTitleDateState
1ABC01/01/2022New
1ABC01/02/2022Ready For Test
1ABC01/03/2022Failed Test
1ABC01/04/2022Ready For Test
1ABC01/05/2022Failed Test
1ABC01/06/2022Failed Test
2DEF01/01/2022New
2DEF01/02/2022Ready For Test
2DEF01/03/2022Failed Test
2DEF01/04/2022Ready For Test
2DEF01/05/2022Closed
3XYZ01/06/2022Closed
3XYZ01/01/2022New
3XYZ01/02/2022Ready For Test
3XYZ01/03/2022Closed
3XYZ01/04/2022Closed
3XYZ01/05/2022Closed
3XYZ01/06/2022Closed

 

What I am trying to achieve is the following:

Work Item IDTitleNo. Times Failed Test
1ABC2
2DEF1
3XYZ0

 

Can anyone suggest the best way to achieve this either by a measure or a column where I can show the number of times the work item state entered Failed Test, please?

 

Thanks for your help in advance

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

Hi @ray67052 
you can create a column with this:

StateChange =
VAR CurrentDate = TableName[Date]
RETURN
    CALCULATETABLE(
        VALUES(TableName[State]),
        TableName[Date] = CurrentDate-1,
        ALLEXCEPT(TableName, TableName[ID], TableName[Title])
    )
&"->"&TableName[State]
 
then create a SumTable with this:
SumTable =
ADDCOLUMNS(    
   SUMMARIZE(TableName, TableName[ID], TableName[Title]),
    "No. Timies Failed Test",
    CALCULATE(
        COUNTROWS(TableName),
        TableName[StateChange] in {"New->Failed Test", "Ready For Test->Failed Test" }
    )
)
 
i tried and it worked like this:
FreemanZ_0-1670159502797.png

 

FreemanZ_1-1670159518307.png

 

View solution in original post

2 REPLIES 2
FreemanZ
Super User
Super User

Hi @ray67052 
you can create a column with this:

StateChange =
VAR CurrentDate = TableName[Date]
RETURN
    CALCULATETABLE(
        VALUES(TableName[State]),
        TableName[Date] = CurrentDate-1,
        ALLEXCEPT(TableName, TableName[ID], TableName[Title])
    )
&"->"&TableName[State]
 
then create a SumTable with this:
SumTable =
ADDCOLUMNS(    
   SUMMARIZE(TableName, TableName[ID], TableName[Title]),
    "No. Timies Failed Test",
    CALCULATE(
        COUNTROWS(TableName),
        TableName[StateChange] in {"New->Failed Test", "Ready For Test->Failed Test" }
    )
)
 
i tried and it worked like this:
FreemanZ_0-1670159502797.png

 

FreemanZ_1-1670159518307.png

 

Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1670158851218.png

 

 

No. Failed Test measure: =
COUNTROWS (
    FILTER (
        ADDCOLUMNS (
            Data,
            "@prevstate",
                MAXX (
                    FILTER (
                        Data,
                        Data[Work Item ID] = EARLIER ( Data[Work Item ID] )
                            && Data[Title] = EARLIER ( Data[Title] )
                            && Data[Date]
                                = EARLIER ( Data[Date] ) - 1
                    ),
                    Data[State]
                )
        ),
        Data[State] = "Failed Test"
            && [@prevstate] <> "Failed Test"
    )
) + 0

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

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.