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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

Aggregate by months and calculate average

Hello,

i have a table like the following one:

REQUESTED_DATEVALUE
01.01.201810
......
28.01.20188


I want to show the following in a line diagram:

X-axis: fixed 12 months (january-december; business year)

First line:

VALUE summed for each month

Second line:

Avergage of VALUE last year as a straight line (but mapped/shown to the fixed X-axis)

 

How can i achieve this?

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

Create a measure

average last year = CALCULATE(AVERAGE('Table 3'[value]),FILTER(ALLSELECTED('date'),DATEADD('date'[Date],-1,YEAR)))

Capture2.JPGCapture3.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
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

3 REPLIES 3
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

Create a measure

average last year = CALCULATE(AVERAGE('Table 3'[value]),FILTER(ALLSELECTED('date'),DATEADD('date'[Date],-1,YEAR)))

Capture2.JPGCapture3.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , Try with time intelligence

 

YTD Sales = CALCULATE([Avg Monthly],DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE([Avg Monthly],DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
This year Sales = CALCULATE([Avg Monthly], DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last year Sales = CALCULATE([Avg Monthly],DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Last to last YTD Sales = CALCULATE([Avg Monthly],DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))

 

 

Refer Power BI — YTD Questions — Time Intelligence 1–5
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-YTD-LYTD-Week-Over-Week/m-p/1051626#M184


Appreciate your Kudos.

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
Anonymous
Not applicable

Thank you for your quick reply.

Could you also explain me how to achieve the aggregation by month?
I have lots of dates but don't know, how to aggregate them for a line chart.

This is my expected result:

MIuser1_0-1595331063657.png

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors