Forum Discussion
4 Week Average with a Day Filter
- 2 years ago
Hi,
Thank you for your message.
Please check the below and the attached pbix file if it suits your requirement.
4 Week Average = VAR _fourweekstable = WINDOW ( -3, REL, 0, REL, SUMMARIZE ( ALL ( 'PpOH Request from Harold' ), 'Calendar'[Week Ending Date] ), ORDERBY ( 'Calendar'[Week Ending Date], ASC ) ) VAR _condition = COUNTROWS ( _fourweekstable ) = 4 RETURN IF ( _condition, AVERAGEX ( _fourweekstable, CALCULATE ( SUM ( 'PpOH Request from Harold'[PatronHours] ) ) ) )
Hi Jihwan_Kim
I've attached it here
https://drive.google.com/file/d/1fC-Z7UIfen1OZiedW1kMzYUuU8K_XZx4/view?usp=drivesdk
thanks again!
Hi,
Thank you for your message.
Please check the below and the attached pbix file if it suits your requirement.
4 Week Average =
VAR _fourweekstable =
WINDOW (
-3,
REL,
0,
REL,
SUMMARIZE ( ALL ( 'PpOH Request from Harold' ), 'Calendar'[Week Ending Date] ),
ORDERBY ( 'Calendar'[Week Ending Date], ASC )
)
VAR _condition =
COUNTROWS ( _fourweekstable ) = 4
RETURN
IF (
_condition,
AVERAGEX (
_fourweekstable,
CALCULATE ( SUM ( 'PpOH Request from Harold'[PatronHours] ) )
)
)- Anonymous2 years agoNot applicable
Hi Jihwan_Kim,
Just wanted to say thank you as it worked perfectly. However because the data file is so big I have moved to a DirectQuery from Big Query. I am now getting this issue The column 'Week Ending Date1' specified in the 'SUMMARIZE' function was not found in the input table. What would a workaround be?- Jihwan_Kim2 years ago
Super User
Hi,
In the case of having weak relationship (between direct query table and import table), summarize dax function does not work. Summarize dax function works well under strong relationship.
Summarize is just one of many dax functions that describes the outcome as table.
In this case, use other dax functions that construct tables.