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
Keiser
Frequent Visitor

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 

Keiser_0-1646054187926.png

 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 5
Daryl-Lynch-Bzy
Resident Rockstar
Resident Rockstar

Hi @Keiser - 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 ) )

 

@Daryl-Lynch-Bzy ,

 

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

Keiser_0-1646059120188.png

This gives me a table like this

Keiser_1-1646059198223.png

When I enter the Dax to shift 2 years:

Keiser_2-1646059249578.png

This is the Outcome 

Keiser_3-1646059304680.png

 

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

 

Hi @Keiser ,  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 ) )

 

DarylLynchBzy_0-1646125580266.png

 

 

 

Daryl-Lynch-Bzy
Resident Rockstar
Resident Rockstar

Hi @Keiser , 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?

Yes just want to compare  2 years apart 🙂

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