Forum Discussion
Actuals vs Average + Chart Date Filtering
Hi all,
Having an issue with filtering a chart that contains a measure which subtracts a 3-month average of Actuals pre Project start date (Dec19) from current Actuals.
Per screenshot below, when I add a Date filter with advanced filter 'is on or after' Dec19, I still see all of 2019 and 2021.
I only want to see Dec19 to today's date (Nov20).
VALUE MEASURE
SUPPORTING MEASURES
Hi Anonymous ,
Sorry for the late reply,try to use "dateadd" instead of "dateinperiod":
AVG.PRE-REV = CALCULATE( [MRR(no RFS)] , DATEADD( 'CALENDAR'[Date] , -3 , MONTH )&& MAX( PROJECT_LOOKUP[RFS.DATE] )<=DATE(2020,11,31))) /3Best Regards,
KellyDid I answer your question? Mark my post as a solution!
8 Replies
- v-kelly-msft
Community Support
Hi Anonymous ,
Modify the direction of the relationship from single to both:
And you will see:
For the related .pbix file,pls see attached.
Best Regards,
KellyDid I answer your question? Mark my post as a solution!
- AnonymousNot applicable
v-kelly-msft thanks for the response.
I still have the issue that the months are still visible outside of the range I want to see (i.e. all of 2019 and 2021).
Also, in my actual data model I have other tables linked to the 'CALENDAR' table and 'PROJECT_LOOKUP' tables so that I receive this error when I try to change that relationship to 'Both':
- v-kelly-msft
Community Support
Hi Anonymous ,
Direction is important in relationships,you may try star schema instead.
See the reference below:
https://docs.microsoft.com/en-us/power-bi/guidance/star-schema
Best Regards,
KellyDid I answer your question? Mark my post as a solution!
- AnonymousNot applicable
Hi v-kelly-msft , understood re. the relationships, however even with the correct schema, the visual still shows all of 2019 and 2021 (albeit now with blanks).
I want to only show the months of 2020 up until November.
Thanks,Jake
- v-kelly-msft
Community Support
Hi Anonymous ,
How about modifying your measure as below:
AVG.PRE-REV = CALCULATE( [MRR(no RFS)] , DATESINPERIOD( 'CALENDAR'[Date] , EDATE( MIN( PROJECT_LOOKUP[RFS.DATE] ), -1 ) , -3 , MONTH )&& MAX( PROJECT_LOOKUP[RFS.DATE] )<=DATE(2020,11,31))) /3Best Regards,
KellyDid I answer your question? Mark my post as a solution!
- AnonymousNot applicable
Hi v-kelly-msft ,
Unfortunately this modification generates an error:
"A function 'DATESINPERIOD' has been used in a True/False expression that is used as a table filter expression. This is not allowed."
I tried adding a 'FILTER ( ALL (' to correct it but still came up with the same error.
I do think that the answer is somewhere in modifying one or more of these measures though
Any thoughts?
Kind regards,Jake