The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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:
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.
# 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!
@aggiebrown , Create a new measure and use that
Measure = Sumx(VALUES(dim_date[date]), [# Meetings Created - 1 week average])