Forum Discussion

FlowViz's avatar
FlowViz
Helper III
4 years ago

Calculating count of values between dates

Hey folks,

 

Need help calculating something between my [Dates] and [WorkItems History] tables in this report.

[Dates] has a list of dates in it, the [WorkItems History] contains history of items, but specifically interested in the InProgressDate and CompletedDate columns.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I want to know on a given date, how many items are InProgress (i.e. not completed) AND how long they have been in progress on a given date, grouped into - <= 1 day, <= 7 days, <= 14 days and > 14 days in progress. I'm trying to recreate these 2 charts:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

PBIX file is here in case it helps - but really could do with some expertise here as I'm stuck 😞 

2 Replies

  • FlowViz create the relationship between date table and inprogress date columns, if you already have relationship on another column with the date table and then this new relationship will be inactive which is fine, and you can write following measure to make inactive relationship to active to get the count:

     

    InProgress Count = 
    CALCULATE ( 
       COUNTROWS ( YourTable ),
       USERELATIONSHIP ( YourTable[InProgressDate], DateTable[Date] ) 
    )

     

    and to visualize, use a column from the date column and above measure. For the 2nd question, check out this dynamic segmentation blog post and you can tweak it to make it work for you.

     

     

     

    Follow us on LinkedIn and  to our YouTube channel

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

     

    Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.

    • FlowViz's avatar
      FlowViz
      Helper III

      Thanks for the suggestion. That doesn't quite give me what I'm after:

      It only shows dates where something goes 'InProgress' not the count of how many items are InProgress on a given date...