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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
aggiebrown
Helper III
Helper III

How to sum a measure that is a complex average

Hi, I have a few measures which are quire complex (calculating rolling and static 7 day average for meetings booked and using date intelligence within DAX to achieve this), and I came across an issue. Whilst the projected average shows correctly for individual days within the month, it also shows same average number at Total level, and I want to sum it there. Example below:

 

aggiebrown_1-1701876080450.png

 

Using these 2 measures to achieve "2" as an average I want to predict for each day and total at the end of the period. 

Any help would be appreciated. I am attaching a link to the PBI Desktop file too.

Power BI Desktop File 

# Meetings Created = 
CALCULATE (
    DISTINCTCOUNT ( 'fact'[pipeline_journey_id] ),
    'fact'[total_meetings_booked] > 0
)
# Meetings Created - 1 week average = 

//Selecting the date in the range
VAR _LastDate =
MAX ( dim_date[date] )
//Defining the duration to be considered for average calculation(k)
VAR _Duration = 7
//Filtering the Calendar Table for the defined range
VAR _CalculationPeriod =
FILTER (
ALL ( dim_date[date] ), 
AND (
dim_date[date] > _LastDate - _Duration,
dim_date[date] <= _LastDate 
)
)
//Calculating the Moving Average
VAR _MovingAverage =
IF (
COUNTROWS ( _CalculationPeriod ) >= _Duration,
CALCULATE (
AVERAGEX(dim_date,[# Meetings Created]), 
_CalculationPeriod
)
)

VAR __StaticAverage =

CALCULATE(
    AVERAGEX(
        dim_date,[# Meetings Created]),
        FILTER(
            ALL(dim_date), dim_date[date] >= TODAY()-8  && dim_date[date] < TODAY() && dim_date[is_weekend_flag]=0))

VAR __lastDate = max(dim_date[date])
VAR __FirstDate = TODAY()
VAR __ShowData = (__FirstDate <= __lastDate)

VAR __Result = IF(
                    __ShowData,
                        Calculate(__StaticAverage))

RETURN __Result

 Thanks!

1 REPLY 1
amitchandak
Super User
Super User

@aggiebrown , Create a new measure and use that

Measure = Sumx(VALUES(dim_date[date]), [# Meetings Created - 1 week average])

 

 

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

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors