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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
PremaBoddeda
Frequent Visitor

To Calculate average including the dates where values are not present

Hi!

 I want to view the Average as a line so I can understand the Average Payments made in that period. The average line should change based on the values visible on the x-axis (so Avg will change when drill up happens). If Payment does not occur on any day the value should be considered as Zero and not Null. For example: In a week, only for 5 days payment has been done then it is calculated as total/5 whereas I need total/7. `I have used clustered column chart in which we have an average line in the analytics pane. So please help me.
 
Thanks,
Prema
 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@PremaBoddeda . Try like

 

sum(Table[Payment])/ (datediif(min(Table[Date]), max(Table[Date]), day) +1)

 

 

or

new measure = //joined date table
var _max = maxx(allselected(Date),Date[Date])
var _min = minx(allselected(Date),Date[Date])
return

sum(Table[Payment])/ (datediif(_min, _max, day) +1)

 

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

3 REPLIES 3
PremaBoddeda
Frequent Visitor

Thankyou so much @amitchandak 

amitchandak
Super User
Super User

@PremaBoddeda . Try like

 

sum(Table[Payment])/ (datediif(min(Table[Date]), max(Table[Date]), day) +1)

 

 

or

new measure = //joined date table
var _max = maxx(allselected(Date),Date[Date])
var _min = minx(allselected(Date),Date[Date])
return

sum(Table[Payment])/ (datediif(_min, _max, day) +1)

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi@amitchandak

It is working as expected when I placed that measure in table it is being total but while placing the measure in line y-axis in Dual Axis Visual I am unable to get the line in datelevel. So could you please suggest A solution for this. I am attaching the Screen shot for your reference

PremaBoddeda_0-1666163264384.png

 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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