Forum Discussion

LyonsBI_BRL's avatar
LyonsBI_BRL
Helper III
4 years ago
Solved

Count Number of Rows - Based on Start Date

I have rather an interesting challenge I'm looking at here. I need to calculate the number of employees who have started each month. And I need to also calculate the number of employees who have completed their assignement each month. I need to figure out how would I count the number of rows who have started during the month, the number of rows of people who have left or wil be leaving that month, and what my running total is each month.

 

 

  • Jihwan_Kim's avatar
    Jihwan_Kim
    4 years ago

    Hi,

    I am not sure whether I understood your question correctly, but please check the below picture and the attached pbix file.

    All measures are in the attached pbix file.

     

     

3 Replies

  • Hi,

    I am not sure how your data model looks like, but I suggest having a dim-calendar table like below.

    Please check the below picture and the attached pbix file.

     

     

    Employees count: =
    IF (
    HASONEVALUE ( 'Calendar'[Month & Year] ),
    CALCULATE (
    COUNTROWS ( Data ),
    FILTER (
    Data,
    MIN ( 'Calendar'[Date] ) <= Data[dateEnd]
    && MAX ( 'Calendar'[Date] ) >= Data[dateBegin]
    )
    )
    )

    • LyonsBI_BRL's avatar
      LyonsBI_BRL
      Helper III

      Jihwan_Kim That worked!

       

      Is there a way I can see the net difference between each month from month to month?

       

       

      • Jihwan_Kim's avatar
        Jihwan_Kim
        Super User

        Hi,

        I am not sure whether I understood your question correctly, but please check the below picture and the attached pbix file.

        All measures are in the attached pbix file.