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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

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

 

BRR.VS.AVG =
IF(
MAX( PROJECT_LOOKUP[RFS.IND] ) = "No"
, 0
, IF(
MAX( 'CALENDAR'[Date] ) < MAX( PROJECT_LOOKUP[RFS.DATE] )
, 0
, [MRR(no RFS)] - [AVG.PRE-REV]
))

 

SUPPORTING MEASURES

 

MRR(no RFS) =
CALCULATE(
SUM( REVENUE[USD_BUDGET_AMT] )
, REVENUE[GL_REVENUE_CATEGORY_CD] = "BRR"
|| REVENUE[GL_REVENUE_CATEGORY_CD] = "Billable Run Rate"
)

 

AVG.PRE-REV =
CALCULATE(
[MRR(no RFS)]
, DATESINPERIOD( 'CALENDAR'[Date] , EDATE( MIN( PROJECT_LOOKUP[RFS.DATE] ), -1 ) , -3 , MONTH )
)
/3

 

PBIX FILE 

 

 

Visual1.PNG

 

 

 

 

1 ACCEPTED SOLUTION

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)))
/3

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

 

View solution in original post

8 REPLIES 8
Anonymous
Not 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

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)))
/3

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

Anonymous
Not 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

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)))
/3

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

 

Anonymous
Not applicable

Hi @v-kelly-msft,

That measure still generates an error:

"A function 'DATESADD' has been used in a True/False expression that is used as a table filter expression. This is not allowed."

 

 

Jake

Anonymous
Not 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':

 

Error1.PNG

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,
Kelly

Did I answer your question? Mark my post as a solution!

v-kelly-msft
Community Support
Community Support

Hi  @Anonymous ,

 

Modify the direction of the relationship from single to both:

Screenshot 2020-11-20 175859.png

And you will see:

 

Screenshot 2020-11-20 175838.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.