Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

Compare Staff Counts in Years

Hello,

 

I have a staff Count in Months from April 2021 - Aug 2023. I also have another staff Count for April 2023 - Aug 2025. The data looks as below 

 Im trying to do a table which compares each month 

Example:

April 2021 - 225 staff  April 2023 - 220 Staff

 

Any help would be appreciated

 

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous , Could you please confirm that the comparative periods are always same month 2 years apart?  e.g. do you want the ability to compare March 2023 to April 2024 or April 2025?

    • Anonymous's avatar
      Anonymous
      Not applicable

      Yes just want to compare  2 years apart 🙂

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous - you should consider using the PARALLELPERIOD dax function to change the filter context.  This allows you to specify a number of intervals.  This would include 2 YEAR.  The function would look something like this:

    Function Name = CALCULATE ( [Count of Employees] , PARALLELPERIOD ( 'Date'[Date] , 2 , YEAR ) )

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Anonymous ,

       

      So this is the dax for how I get i get my staff count from April 2021-Aug 2023

      This gives me a table like this

      When I enter the Dax to shift 2 years:

      This is the Outcome 

       

      Sorry Im new to power BI and Im probebly doing somthing wrong

       
      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Anonymous ,  my suggestion to use the Parallelperiod would result in two measures.  Current Month and Comparative Month, but I did not realise that you how your "pre suspension staff count" was working.

        Instead of using the Parallelperiod, you will need to modified the "selectedDate" variable to shift it by 2 years.  Consider the following examples:

         

        DateCurrent = MIN( 'Calendar'[Date] )
        DataAdd = CALCULATE( MIN( 'Calendar'[Date] ) , DATEADD( 'Calendar'[Date] , 2, YEAR ) )