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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
ggzmorsh
Helper II
Helper II

Average of total values between dates

I have a table where it displays date values from a slicer and their total amounts.

I used a measure to calculate the average of those totals between the date selected.

Instead it is giving me the average of the totals per day.

 

Accept average per Date =
AVERAGEX(KEEPFILTERS(VALUES('Calendar Date'[Date])), CALCULATE([Total Accept]))
 
Accept average per DateDate
207609/01/2019
154109/02/2019
180209/03/2019
153609/04/2019
134809/05/2019
192909/07/2019
155909/08/2019
195209/09/2019
142109/10/2019
1685The average of totals

 

What measure should i use to get this result:

 

Accept average per DateDate
207609/01/2019
154109/02/2019
180209/03/2019
153609/04/2019
134809/05/2019
192909/07/2019
155909/08/2019
195209/09/2019
142109/10/2019
1516The sum of totals per day divided by number days between selected dates. or average of total per days.
1 ACCEPTED SOLUTION
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @ggzmorsh ,

If I understand your requirement correctly that you want to calculate the average for the selected date range.

If so, please refer to the measures below.

interval days =
VAR maxday =
    MAX ( 'Table'[Date] )
VAR minday =
    MIN ( 'Table'[Date] )
RETURN
    DATEDIFF ( minday, maxday, DAY ) + 1

Average =
VAR total =
    CALCULATE ( SUM ( 'Table'[Value] ), ALLSELECTED ( 'Table' ) )
RETURN
    DIVIDE ( total, [interval days] )

Here is the output.

Capture.PNG

More details, you also could refer to my attachement.

If you still need help, please share your desired output so that we could help further on it.

Best Regards,

Cherry

 

Community Support Team _ Cherry Gao
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
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @ggzmorsh ,

If I understand your requirement correctly that you want to calculate the average for the selected date range.

If so, please refer to the measures below.

interval days =
VAR maxday =
    MAX ( 'Table'[Date] )
VAR minday =
    MIN ( 'Table'[Date] )
RETURN
    DATEDIFF ( minday, maxday, DAY ) + 1

Average =
VAR total =
    CALCULATE ( SUM ( 'Table'[Value] ), ALLSELECTED ( 'Table' ) )
RETURN
    DIVIDE ( total, [interval days] )

Here is the output.

Capture.PNG

More details, you also could refer to my attachement.

If you still need help, please share your desired output so that we could help further on it.

Best Regards,

Cherry

 

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

Worked perfectly. Thanks!

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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