Forum Discussion

baseballtheory's avatar
baseballtheory
Regular Visitor
4 years ago

Translate COUNTIFS solution from Excel to Power BI - Counting number of historic outstanding rows

Looking for some assistance as to a starting point for the below requirement.

 

I have simplified my dataset as per below.  The context is as follows

 

  1. We have two milestones we must achieve per project undertaken. 
  2. Each Milestone has a Due date once active. (8 weeks in this simplistic example)
  3. Milestone 2 does not become active until Milestone 1 is completed.
  4. The data available tells me when the Due Date is and if completed what week it was completed in.
  5. If the Milestone is not active it will not have a due date and is therefore not required to be assessed / part of the summary.

 

 

YearProjectRegionAreaMilestoneDue WeekStatusCompletion Week
202120AUKNorth UK121.08Completed21.11
202120BUKSouth UK121.16Completed21.20
202120CEURWest Eur121.20Completed21.30
202120DEUREast Eur121.24Completed21.25
202120EUSNorth US121.36Completed21.38
202120FUSSouth US121.42Completed21.42
202120AUKNorth UK221.19Completed21.25
202120BUKSouth UK221.28Completed21.30
202120CEURWest Eur221.38Completed21.45
202120DEUREast Eur221.33Completed21.50
202120EUSNorth US221.46Completed21.48
202120FUSSouth US221.50Completed21.50
202221AUKNorth UK122.08Completed22.09
202221BUKSouth UK122.16Completed22.20
202221CEURWest Eur122.20Completed22.28
202221DEUREast Eur122.24Completed22.30
202221EUSNorth US122.36Not Started 
202221FUSSouth US122.42Not Started 
202221AUKNorth UK222.17Completed22.20
202221BUKSouth UK222.28Completed22.33
202221CEURWest Eur222.36Not Started 
202221DEUREast Eur222.38Not Started 
202221EUSNorth US2 1 not complete 
202221FUSSouth US2 1 not complete 

 

 

The type of output I initially want to achieve is as below.  I have chosen the Area field as the 'row' data but would like the ability to also display this by the other fields, such as Year, Project, Region etc.

 

It shows for any given week how many Milestones were outstanding.

 

The intention is that each milestone would have it's own table, so the below is based on milestone 1

 

Obviously this is meant to account for all weeks whereas the data set only tells us when a milestone was due and if and when it was completed.

 

[The weeks are a combo of year and week number]

 

I have achieved the above in excel with the following formula ; 

 

=COUNTIFS(Data[Milestone],1,Data[Due Week],"<="&L$1,Data[Status],"Not Started",Data[Area],[@Area])
+
COUNTIFS(Data[Milestone],1,Data[Due Week],"<="&L$1,Data[Status],"Completed",Data[Area],[@Area],Data[Completion Week],">"&L$1)

 

[L$1 refers to the header in the count table and is the week numbers, this increments horizontally]

 

The above is essentially adding the "Not Started" (which were overdue for a reporting week) and those now "Completed" which were not completed (ie overdue) at the time of the reporting week.  The context is for Milestone 1 in each Area.

 

I am looking for a starting point as I have with my limited knowledge tried a few different approaches that have produced nothing that works.

 

My intuition is that I require some kind of framework table which supplies the structure of the output required.  A calculated column or measure may then be required to count the rows.

 

I have tried the above with limited success using CALCULATE(COUNTROWS(FILTER dax commands

 

I was unsure which field to relate the table to as I have two weeks field in my raw data.  Nothing attempted has yielded anything encouraging yet.

 

Any help would be gladly received.

 

 

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi baseballtheory ,

    I'm a little confused about your needs, Could you please explain them further? It would be good to provide a screenshot of the results you are expecting.

    Thanks for your efforts & time in advance.

     

    Best regards,
    Community Support Team_ Binbin Yu