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
m_roussakis
Helper III
Helper III

How to Calculate total rows for previous year

I've been googling this for an hour...have tried many things, nothing works. 

 

How would I calculate the total # rows for the previous year. Here's the latest attempt to fail:

 

Total Previous Year = CALCULATE(COUNTROWS('Extra Pulls'),PREVIOUSYEAR('Extra Pulls'[Date]))
 
Any idea? Thanks
1 ACCEPTED SOLUTION
v-rongtiep-msft
Community Support
Community Support

Hi @m_roussakis ,

I have created a simple sample,please refer to it to see if it helps you.'

Create a measure.

Measure = var _1=YEAR(TODAY())-1
return
CALCULATE(COUNTROWS('Table'),FILTER(ALL('Table'),YEAR('Table'[date])=_1))

Or a column.

Column = var _1=YEAR(TODAY())-1
return
CALCULATE(COUNTROWS('Table'),FILTER(('Table'),YEAR('Table'[date])=_1))

vpollymsft_1-1669863221718.png

vpollymsft_2-1669863223535.png

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Polly

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-rongtiep-msft
Community Support
Community Support

Hi @m_roussakis ,

I have created a simple sample,please refer to it to see if it helps you.'

Create a measure.

Measure = var _1=YEAR(TODAY())-1
return
CALCULATE(COUNTROWS('Table'),FILTER(ALL('Table'),YEAR('Table'[date])=_1))

Or a column.

Column = var _1=YEAR(TODAY())-1
return
CALCULATE(COUNTROWS('Table'),FILTER(('Table'),YEAR('Table'[date])=_1))

vpollymsft_1-1669863221718.png

vpollymsft_2-1669863223535.png

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Polly

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

thanks that worked. If I want to see total YTD would it be:

 

Previous Year Total = var _1=YEAR(TODAY())
return
CALCULATE(COUNTROWS('Extra Pulls'),FILTER(all('Extra Pulls'),YEAR('Extra Pulls'[ACTL_EVT_DT])=_1))

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