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
Anonymous
Not applicable

Calculate the count of this year Vs Last year

Greeting all  ,

 

Well im trying to create 2 measures , one that will display the number of babies born by month year and the other measure that calculate the number of babies born by month year - 1

here as exemple of what im trying to do : 

 

rfrikha_0-1624269564315.png

So if we take the first column , the first measure will display the number of babies in september 2020 and the other measure will display the number of babies in september 2019 . 

 

assume that im using 2 tables , Babies_Details , and normal Date table where i created a calculated column called Month Year . 

 

i was able to create the first Measure , it's simple just count row and filter them by Month year . my issue here a trick that can help me create the second measure the N-1 . 

 

Thanks all in advance ^^ 

 

 

 

1 ACCEPTED SOLUTION
HashamNiaz
Solution Sage
Solution Sage

Hi @Anonymous !

 

You cna create a second measure using below DAX;

 

LastYearBabyCount = CALCULATE([BabyCount], DATEADD('Calendar'[Date], -1, YEAR))

 

You can replace BabyCount wih your first measure name, this will calculate the no. of babies in previous year.

 

Regards,

Hasham

View solution in original post

2 REPLIES 2
HashamNiaz
Solution Sage
Solution Sage

Hi @Anonymous !

 

You cna create a second measure using below DAX;

 

LastYearBabyCount = CALCULATE([BabyCount], DATEADD('Calendar'[Date], -1, YEAR))

 

You can replace BabyCount wih your first measure name, this will calculate the no. of babies in previous year.

 

Regards,

Hasham

Anonymous
Not applicable

Thanks , it works . 

 

i tho about it , but i was afraid that maybe it wont work with the filter of date month . Thanks again for ur answer , u saved me 🙂 ^^ 

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.