Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
aszpic
Frequent Visitor

Count values of the same month last year

Hello everyone,

 

I have been looking in the forum for the answer to this issue but couldn't get with the answer.

 

I have a table (let's call it MyTable) with 2 columns: [Values] and [Date].

 

The graphic I want to make is a simple one: with months as X axis, and in the Y axis the difference between the amount of values on the month of the axis and the amount of values of the same month of the previous year (so I have the variability in %).

 

I can make a simple measure that counts the amount of values of a certain month, simply using the COUNTA function and filtering the months with the graphic and the year with a slicer, but I couldn't find a way to count the amount of values of the same month of the previous year.

 

Thanks in advance!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

You had tried DateAdd?

 

 

= COUNT(MyTable[Values])/
        CALCULATE( COUNT(MyTable[Values]);DATEADD( MyTable[Date];-1;YEAR))

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

You had tried DateAdd?

 

 

= COUNT(MyTable[Values])/
        CALCULATE( COUNT(MyTable[Values]);DATEADD( MyTable[Date];-1;YEAR))

EDIT: It worked, thanks! I didn't know how the function DATEADD worked.

I tried doing that. It gives me an error on the visual, saying "MyTable[Value]: A date column containing duplicate dates was specified in the call to function 'DATEADD'. This is not supported. I don't understand this error... I thought DATEADD was just a movement of the dates 1 year backwards.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors