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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Syndicate_Admin
Administrator
Administrator

Show all the previous year in the graph

Good morning

I currently have this chart:

Golondrina_0-1653984815349.png

From the year 2021 I have the information, that is, data in all the months, but I do not know why when comparing it with 2022 it does not show them to me. How can I fix it?

Thanks a lot

1 ACCEPTED SOLUTION

Hi @Golondrina 

 

So you can try 

Current Average = CALCULATE ( AVERAGE ( 'Table (2)'[Count] ), 'Date'[Year] = YEAR ( TODAY () ) )
Previous Average = CALCULATE ( AVERAGE ( 'Table (2)'[Count] ), 'Date'[Year] = YEAR ( TODAY () ) - 1 )

It always gets the current year from today's date. 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

6 REPLIES 6
v-jingzhang
Community Support
Community Support

Hi @Golondrina 

 

Try providing a specific year value for the measure. 

Previous average = CALCULATE(AVERAGE('Table (2)'[Count]),'Date'[Year]=2021)
Current Average = CALCULATE(AVERAGE('Table (2)'[Count]),'Date'[Year]=2022)

vjingzhang_0-1654244180950.png

 

If it still doesn't work, can you provide a pbix file with fake data which can reproduce this problem? At present the measure looks good so the cause may be somewhere else. 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

wanting it to be a dynamic graph and that when I have new data I do not have to modify years, I have done itby modifying the calendar table so that it has tood in 2022.

Thank you very much as well,

Hi @Golondrina 

 

So you can try 

Current Average = CALCULATE ( AVERAGE ( 'Table (2)'[Count] ), 'Date'[Year] = YEAR ( TODAY () ) )
Previous Average = CALCULATE ( AVERAGE ( 'Table (2)'[Count] ), 'Date'[Year] = YEAR ( TODAY () ) - 1 )

It always gets the current year from today's date. 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Syndicate_Admin
Administrator
Administrator

If the measure I am using is as follows for the previous year:
Previous average =
CALCULATE(AVERAGE(Estad_prod_envio_diario[Times]),dateadd(Calendar[Date],-1,YEAR))
amitchandak
Super User
Super User

@Syndicate_Admin , If you have a date then you can create a year behind measure

 

Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),SAMEPERIODLASTYEAR('Date'[Date]))

 

Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

If the measure I am using is as follows for the previous year:
Previous average =
CALCULATE(AVERAGE(Estad_prod_envio_diario[Times]),dateadd(Calendar[Date],-1,YEAR))

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.