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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

12 month Avg constant line on 13 month bar chart

Hi, 
I am looking for a DAX measure which can show me 12 month avg for previous 12 months as a constant line on bar chart. As shown below.

MK85_1-1715271210538.png

Thanks in advance

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Thanks for the reply from @Greg_Deckler .

 

First, create a disconnected date table:

Date = VALUES('Table'[Date])

 

Apply this disconnected table as a slicer.

 

Create a measure:

12-Month Average =
CALCULATE(
     AVERAGE('Table'[Value]),
     DATESINPERIOD('Table'[Date], SELECTEDVALUE('Date'[Date]), -12, MONTH)
)

 

Set up the chart as follows:

vhuijieymsft_0-1715333312749.png

vhuijieymsft_1-1715333312749.png

 

The final page effect is as follows:

vhuijieymsft_2-1715333322749.png

vhuijieymsft_3-1715333322753.png

 

pbix file is attached.

 

If you have any further questions please feel free to contact me.

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous ,

 

Thanks for the reply from @Greg_Deckler .

 

First, create a disconnected date table:

Date = VALUES('Table'[Date])

 

Apply this disconnected table as a slicer.

 

Create a measure:

12-Month Average =
CALCULATE(
     AVERAGE('Table'[Value]),
     DATESINPERIOD('Table'[Date], SELECTEDVALUE('Date'[Date]), -12, MONTH)
)

 

Set up the chart as follows:

vhuijieymsft_0-1715333312749.png

vhuijieymsft_1-1715333312749.png

 

The final page effect is as follows:

vhuijieymsft_2-1715333322749.png

vhuijieymsft_3-1715333322753.png

 

pbix file is attached.

 

If you have any further questions please feel free to contact me.

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

Anonymous
Not applicable

It works. Many thanks @Anonymous 

Greg_Deckler
Community Champion
Community Champion

@Anonymous (3) Better Rolling Average - Microsoft Fabric Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

It doesn't work for as I have dates on x-axis from date table and my context is changing every month, which gives me variable avg for each month.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors