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
sixtoquiles
Helper II
Helper II

Sales for this year and last year

HI I need to a solution, I wanna to count how record are from january-2016 to today() minus one year.

 

Example:

Today-1year = 8/11/2016

 

Count record from 1/1/2016 to 8/11/2016

2 REPLIES 2
MFelix
Super User
Super User

Hi @sixtoquilles,

Add this measure

PY = TOTALYTD ( COUNT(Table[Record]), Dateadd(Today(), -1,YEAR)

If you want to make the date based on a date in a column replace the TODAY() bt that column name.

Regards,
MFelix

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português




@MFelix wrote:
@Hi @sixtoquilles,

Add this measure

PY = TOTALYTD ( COUNT(Table[Record]), Dateadd(Today(), -1,YEAR)

If you want to make the date based on a date in a column replace the TODAY() bt that column name.

Regards,
MFelix

Sorry, but I dont' think the above will work as both 'DATEADD' and 'TOTALYTD' require an actual column reference.

 

If you have a best practice 'Calendar' table you can do this:

 

PY =
TOTALYTD ( COUNT ( Table[Column] ), SAMEPERIODLASTYEAR ( Calendar[Date] ) )

 

 

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.