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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Count of Status

Hi All.

I have a requirement to calculate the number of time a submission number has toggled between different teams for two scenarios. 

Data below:
Capture1.JPG

I need to derive two columns based on the below scenarios

 

Scenario 1: Overall Toggle count

I need to get the number of times a submission number has toggled between teams i.e column U.

Eg : For submission number : count is 5

Cell U3, U4 (U 3 and U4 - same team ) to U5 = 1 time (IRB Staff to Study Team)

U5 to U 6 = 1 time ( Study team to IRB Staff)

U6 to U7 = 1 time (IRB Staff to Study Team)

U7 to U8 U9 U11 = 1 time ( Study team to IRB Staff)

U11 to U 12 U 13 = 1 time (IRB Staff to Study Team)

Total 5 times

 

Scenario 2: Toggle Count based on Pre-Review/IRB- Review

I need to calculate the number of times a submission number has toggled between teams i.e column U based on Pre-Review/IRB- Review( Column S)

 

For Pre-Review Only :

Capture2.JPG

 

Eg : For the first submission number, for Pre-Review type : count is 4

Cell U3, U4 (U 3 and U4 - same team ) to U5 = 1 time (IRB Staff to Study Team)

U5 to U 6 = 1 time ( Study team to IRB Staff)

U6 to U7 = 1 time (IRB Staff to Study Team)

U7 to U8  = 1 time ( Study team to IRB Staff)

Total 4 times

 

Same has to be derived for IRB Review where count is 1 

U9 U10 to U12 U 13 = 1 time (IRB Staff to Study Team)

 

Sample data:

 

Submission NumberWorkflow StatusWorkflow Status DatePre-Review/IRB- ReviewIRB Staff/Study TeamOverall Toggle CountToggle Count based on Pre-Review/IRB- Review
0005004414-03Routing1/30/2020FALSEFALSE5 
0005004414-03Assigning for Prereview1/31/2020Pre-ReviewIRB Staff54
0005004414-03IRB Staff Pre-Review2/3/2020Pre-ReviewIRB Staff54
0005004414-03Pre-Review Modifications Required2/27/2020Pre-ReviewStudy Team54
0005004414-03Pre-Review Modifications Response2/27/2020Pre-ReviewIRB Staff54
0005004414-03Pre-Review Modifications Required2/28/2020Pre-ReviewStudy Team54
0005004414-03Pre-Review Modifications Response2/28/2020Pre-ReviewIRB Staff54
0005004414-03Assigned to Agenda3/3/2020IRB ReviewIRB Staff51
0005004414-03Approved3/19/2020FALSEFALSE5 
0005004414-03IRB Staff Pre-Review2/28/2020IRB ReviewIRB Staff51
0005004414-03Pre-Review Modifications Required3/3/2020IRB ReviewStudy Team51
0005004414-03Pre-Review Modifications Response3/19/2020IRB ReviewStudy Team51

 

Can some one please let me know how to derive both these columns in Power BI .

 

Thank you

Poojitha

1 ACCEPTED SOLUTION

@Anonymous See attached, Table (24). Toggle Index totals to 5, that's the overall toggle. Toggle Index Team has four 1's for Prereview and one 1 for IRB Review. Is this what you are looking for?

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

14 REPLIES 14
Iryna_K
Frequent Visitor

Try Time in State for Azure DevOps extension https://marketplace.visualstudio.com/items?itemName=SaaSJet.tis-azure .


Using it, you don't need to upload data to Power BI. Reports will be generated automatically based on your Queries. You can also export them to Excel.

Available reports:
- Time in State
- State Count
- Transition Count

Greg_Deckler
Super User
Super User

@Anonymous - OK, so I got this far and then realized that you are going to need an Index. See attached PBIX file attached below sig. Table (24). The reason you need an index is because you have things switching on the same day so it makes it difficult/impossible to know which one is before another one. Is it possible for you to have an Index on this data that represents what happened first?

 

Toggled =
VAR __PreviousDate =
    MAXX (
        FILTER (
            'Table (24)',
            [Workflow Status Date] < EARLIER ( [Workflow Status Date] )
                && [Submission Number] = EARLIER ( [Submission Number] )
                && [IRB Staff/Study Team] <> "FALSE"
        ),
        [Workflow Status Date]
    )
VAR __PreviousTeam =
    MAXX (
        FILTER (
            'Table (24)',
            [Workflow Status Date] = __PreviousDate
                && [Submission Number] = EARLIER ( [Submission Number] )
        ),
        [IRB Staff/Study Team]
    )
RETURN
    IF (
        [IRB Staff/Study Team] = "FALSE"
            || ISBLANK ( __PreviousTeam )
            || __PreviousTeam = [IRB Staff/Study Team],
        0,
        1
    )

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler 

Thank you for the detailed help. I will try the same on the actual dataset and update.

Also can you please let me know if Index has to be added? If yes, could you please help provide the code with the Index field.

Thank you

Poojitha

@Anonymous Sure, updated PBIX attached same table. 

Toggled Index = 
VAR __PreviousIndex =
    MAXX (
        FILTER (
            'Table (24)',
            [Index] < EARLIER ( [Index] )
                && [Submission Number] = EARLIER ( [Submission Number] )
                && [IRB Staff/Study Team] <> "FALSE"
        ),
        [Index]
    )
VAR __PreviousTeam =
    MAXX (
        FILTER (
            'Table (24)',
            [Index] = __PreviousIndex
                && [Submission Number] = EARLIER ( [Submission Number] )
        ),
        [IRB Staff/Study Team]
    )
RETURN
    IF (
        [IRB Staff/Study Team] = "FALSE"
            || ISBLANK ( __PreviousTeam )
            || __PreviousTeam = [IRB Staff/Study Team],
        0,
        1
    )

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler 

I tried to use the logic from the pbix file you shared, but the field is not matching with the values as expected.

Untitled.pngPlease note , we need to derive two columns in PBI which is "Overall Toggle Count" and "Toggle Count based on Pre-Review and IRB Review".

These two columns which are available in the file is for refrence.

Thanks

Poojitha

Anonymous
Not applicable

Can someone please help on fixing this

@Anonymous I need to understand your expected results. 

 

You state:

Eg : For the first submission number, for Pre-Review type : count is 4

Cell U3, U4 (U 3 and U4 - same team ) to U5 = 1 time (IRB Staff to Study Team)

U5 to U 6 = 1 time ( Study team to IRB Staff)

U6 to U7 = 1 time (IRB Staff to Study Team)

U7 to U8  = 1 time ( Study team to IRB Staff)

Total 4 times

 

4 is the number that Toggled returns as you show and is highlighted. So, first, is Toggled flagging the right rows or not?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler 

We are deriving two columns, 

1. "Overall Toggle count" should be irrespective of "Pre-Review" and "IRB Review".

2. "Toggle count based on Pre-Review/IRB Review" should be for "Pre-Review" and "IRB Review" Separately.

@Anonymous OK, so Overall Toggle count should be 4 then? Is that correct?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler 

Overall toggle count should be 5 as we are checking the toggle irrespective of Pre-REview/IRB Review.

Whereas for Toggle count based on Pre-Review/IRB-Review, the count will be 4 when filtered for "Pre-Review"

@Anonymous See attached, Table (24). Toggle Index totals to 5, that's the overall toggle. Toggle Index Team has four 1's for Prereview and one 1 for IRB Review. Is this what you are looking for?

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler 
Thank you, I will test with the entire dataset and update.

Anonymous
Not applicable

@Greg_Deckler 

Is there any way to make this dynamic based on the slicer selections. Since we have derived the index at the power query editor, the toggle values are fixed.

Anonymous
Not applicable

Hi @Greg_Deckler 

Thanks for getting into details.

Yes, the above is true for "Pre-Review". The toggled count=4 should be against "Pre- Review".

Same for "IRB Preview"

Capture1.JPG

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors