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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Bu__
Frequent Visitor

Average of time spent by states in a month

I have a data like this,

Month - YearSum of Time spentCount ofIDAvg. Time spent in Hrs States
Oct-2355.6124.64Active (wip)
Oct-2372.85126.08Assigned
Oct-232.5270.36New
Oct-230.320.15Pending - 3rd Party
Oct-23136.58915.18Pending - End User
Oct-230.1530.05Rejected - Not responsible
Oct-230.18100.02Resolved - Solved for CU
Oct-230.640.15Resolved - SP part finished
Total268.781222.42 

Here the avg time spent in hrs is not totalling properly

It's becasue the Distinct count of ID in the month is 12 but here due to states being repeated in every id , count of ID for each state is showing the number  of times it is appearing when it should be only 12

HEre i have used a dax measure as shown below to calculate average time spent by states in months

ts_avg_month =
CALCULATE(
AVERAGEX (
SUMMARIZE ('Table',
' date'[date] ,
'Table'[ID],
"Monthly Time spent per ID",
SUM ( 'Table'[Time spent] )
),
[Monthly Time spent per id]
)
) so how do i correct this so that i get the correct averages for each states?

Thanks in advance

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Bu__ ,

Please try the following methods and check if they can solve your problem:

1.Create the simple table.

vjiewumsft_0-1709172081188.png

2.Create the new measure to calculate average.

 

st_avg_month = 
VAR Dis_ID = DISTINCTCOUNT('Table'[ID])
RETURN
    DIVIDE(
        SUM('Table'[Time spent]), 
        Dis_ID
    )

 

 

3.Drag the measure into the visual. The result is shown below.

vjiewumsft_1-1709172113877.png

Best Regards,

Wisdom Wu

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

2 REPLIES 2
Anonymous
Not applicable

Hi @Bu__ ,

Please try the following methods and check if they can solve your problem:

1.Create the simple table.

vjiewumsft_0-1709172081188.png

2.Create the new measure to calculate average.

 

st_avg_month = 
VAR Dis_ID = DISTINCTCOUNT('Table'[ID])
RETURN
    DIVIDE(
        SUM('Table'[Time spent]), 
        Dis_ID
    )

 

 

3.Drag the measure into the visual. The result is shown below.

vjiewumsft_1-1709172113877.png

Best Regards,

Wisdom Wu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

 

some_bih
Community Champion
Community Champion

Hi @Bu__ 

It seems that your you did not include State in your SUMMARIZE table

Try v2 below

ts_avg_month 2=

CALCULATE(
AVERAGEX (
SUMMARIZE ('Table',
' date'[date] ,
'Table'[ID],
'Table'[States],
"Monthly Time spent per ID",SUM ( 'Table'[Time spent] )
),
[Monthly Time spent per id]
)
)





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.