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
PBIViz_2024
Advocate I
Advocate I

How would the Dax logic need be written to replicate the same result as the built-in average line

Hi,

I have line chart with Daily actual value for last 30day and I have used a average line as below to show the average of actual value which is a constant line for the period.It looks like below(red dashed line)pbix 

PBIViz_2024_1-1726113661654.png

 

But the problem was when I used built in average line,it doesn't show in tooltip.But my user wants to see both average and actual values in the tooltip for each day.Since this can not be done with this built-in average line.I tried to create a measure and include it as a another line in the chart.But I failed to get a correct dax measure to deliver the same result as average value in the above line.My measure is always fluctuating with the date value.can some one help me on this. I am attaching this sample pbix for more info.

 

Can someone help me on this.

 

Regards,

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@PBIViz_2024 , If you have Avg measure , you can have measure like below and use that using FX option in constant line

 

Avg = calculate([Measure], removefilters(DateTable))

 

Avg = calculate([Measure], allselected())

 

or Avg of Month or day on a Sum measure

 

Avg Month = calculate(Averagex(Vales(Date[Month Year]), [Measure]) , allselected())

 

Avg Day= calculate(Averagex(Vales(Date[Date]), [Measure]) , allselected())

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

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@PBIViz_2024 , If you have Avg measure , you can have measure like below and use that using FX option in constant line

 

Avg = calculate([Measure], removefilters(DateTable))

 

Avg = calculate([Measure], allselected())

 

or Avg of Month or day on a Sum measure

 

Avg Month = calculate(Averagex(Vales(Date[Month Year]), [Measure]) , allselected())

 

Avg Day= calculate(Averagex(Vales(Date[Date]), [Measure]) , allselected())

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

Thanks a lot.It worked.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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
Top Kudoed Authors