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

Measure Not Returning Prior Year Results

Hello all,

I'm trying to get the count of orders for a previous year. I have the answer via filters, but I'm trying to get it in a measure as part of a larger calculation. However, the below function does not seem to be filtering the data and is instead returning the results of all the years. Anyone know why? 

 

Count of Orders in the Previous Year = CALCULATE([Multi Origin Order Count], Filter(FactTable, YEAR(today())-1))
 
Thanks!
1 ACCEPTED SOLUTION
EricHulshof
Solution Sage
Solution Sage

You can try:

 

 

Count of Orders in the Previous Year = CALCULATE([Multi Origin Order Count], Filter(FactTable, [Datecolumn] = YEAR(today())-1))

 


If its a datatimecolumn use YEAR([datecolumn]) ofcourse.


Quality over Quantity


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


View solution in original post

2 REPLIES 2
EricHulshof
Solution Sage
Solution Sage

You can try:

 

 

Count of Orders in the Previous Year = CALCULATE([Multi Origin Order Count], Filter(FactTable, [Datecolumn] = YEAR(today())-1))

 


If its a datatimecolumn use YEAR([datecolumn]) ofcourse.


Quality over Quantity


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


Anonymous
Not applicable

I swapped the filtering of the fact table to filter the date dim table and that worked per your solution. 

 

Count of Orders in the Previous Year = CALCULATE([Multi Origin Order Count], 
 FILTER(DimDate, DimDate[Year] = YEAR(TODAY())-1))

 

Thanks!

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