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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
maurcoll
Helper III
Helper III

Average over 12 months using two different measures

Hi

I am trying to work out the average for the last 12 month period but the criteria changed for the measure

The measure is for the time to respond, the criteria changed in june last year

I have the start of the measure, struggling with how to combine the two to calculate for the year

 

var_ newcriteria =

   CALCULATE([Average time (new)],

    FILTER('Calendar','Calendar'[Date] >= DATE(2024,6,1)
    )
    )
   
VAR oldcriteria =
   CALCULATE([Average time (old)],
     FILTER('Calendar', 'Calendar'[Date] < DATE(2024, 6,1)
    )
    )

RETURN
???
 
I'm not sure how to get the average for the last 12 months which averages the data based on both the old and new criteria.

The date range i am looking at for the last 12 months is 1st May 24 - 30th Apr 25. I have tried adding them together and using the min calendar date but neither is working

1 ACCEPTED SOLUTION
v-hjannapu
Community Support
Community Support

Hi @maurcoll,

Thank you for reaching out to the Microsoft fabric community forum. 

Here are the few steps which you may follow to resolve the issue :

You may calculate the total response time and occurrences for both periods separately, then find the weighted average to ensure correct representation.
Average calculation Measure :

Average Response Last 12 Months = 
VAR StartDate = DATE(2024,5,1)
VAR EndDate = DATE(2025,4,30)

VAR NewCriteriaTime =
    CALCULATE([Total Time (New)], 
        FILTER('Date', 
            'Date'[Date] >= DATE(2024,6,1) && 
            'Date'[Date] <= EndDate))

VAR NewCriteriaCount =
    CALCULATE(COUNTROWS('Date'), 
        FILTER('Date', 
            'Date'[Date] >= DATE(2024,6,1) && 
            'Date'[Date] <= EndDate))


VAR OldCriteriaTime =
    CALCULATE([Total Time (Old)], 
        FILTER('Date', 
            'Date'[Date] >= StartDate && 
            'Date'[Date] < DATE(2024,6,1)))

VAR OldCriteriaCount =
    CALCULATE(COUNTROWS('Date'), 
        FILTER('Date', 
            'Date'[Date] >= StartDate && 
            'Date'[Date] < DATE(2024,6,1)))


RETURN
DIVIDE(
    NewCriteriaTime + OldCriteriaTime,
    NewCriteriaCount + OldCriteriaCount
)


If I misunderstand your needs or you still have problems on it, please feel free to let us know.  
Hope this helps!
If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.

Best Regards, 
Harshitha.
Community Support Team.

 

View solution in original post

5 REPLIES 5
v-hjannapu
Community Support
Community Support

Hi @maurcoll,

Thank you for reaching out to the Microsoft fabric community forum. 

Here are the few steps which you may follow to resolve the issue :

You may calculate the total response time and occurrences for both periods separately, then find the weighted average to ensure correct representation.
Average calculation Measure :

Average Response Last 12 Months = 
VAR StartDate = DATE(2024,5,1)
VAR EndDate = DATE(2025,4,30)

VAR NewCriteriaTime =
    CALCULATE([Total Time (New)], 
        FILTER('Date', 
            'Date'[Date] >= DATE(2024,6,1) && 
            'Date'[Date] <= EndDate))

VAR NewCriteriaCount =
    CALCULATE(COUNTROWS('Date'), 
        FILTER('Date', 
            'Date'[Date] >= DATE(2024,6,1) && 
            'Date'[Date] <= EndDate))


VAR OldCriteriaTime =
    CALCULATE([Total Time (Old)], 
        FILTER('Date', 
            'Date'[Date] >= StartDate && 
            'Date'[Date] < DATE(2024,6,1)))

VAR OldCriteriaCount =
    CALCULATE(COUNTROWS('Date'), 
        FILTER('Date', 
            'Date'[Date] >= StartDate && 
            'Date'[Date] < DATE(2024,6,1)))


RETURN
DIVIDE(
    NewCriteriaTime + OldCriteriaTime,
    NewCriteriaCount + OldCriteriaCount
)


If I misunderstand your needs or you still have problems on it, please feel free to let us know.  
Hope this helps!
If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.

Best Regards, 
Harshitha.
Community Support Team.

 

Hi @maurcoll,
Just wanted to check if you had the opportunity to review the suggestion provided?
If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.

Thank You.

Hi @maurcoll  ,

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please Accept it as a solution so that other community members can find it easily.


Thank you.

Hi @maurcoll,

May I ask if you have resolved this issue? If so, please mark the helpful reply and Accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Best Regards,
Harshitha.
Community Support Team.

johnt75
Super User
Super User

You can use something like

12 Month Average =
VAR DatesToUse =
    DATESBETWEEN ( 'Date'[Date], DATE ( 2024, 5, 1 ), DATE ( 2025, 4, 30 ) )
VAR Result =
    AVERAGEX (
        DatesToUse,
        IF (
            'Date'[Date] >= DATE ( 2024, 6, 1 ),
            [Average time (new)],
            [Average time (old)]
        )
    )
RETURN
    Result

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

May 2025 Monthly Update

Fabric Community Update - May 2025

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