CALCULATE with FILTER

Hi all,

I have a measure which works however is taking around 20 seconds to load. I have identified the issue lies with the filtering within the CALCULATE expression.

Original Measure =

VAR _MinDays = 364 * [Diff Year ISO]

VAR result = CALCULATE( [Total Footfall Week], Count_measurement_feed[date_from] + Count_measurement_feed[Time] <= UTCNOW() + _MinDays)

RETURN

result

Note 1: _MinDays variable returns the value of -364
Note 2: If I remove the _MinDays variable, my measure is much faster however my result isn’t quite accurate.

I have tried to optimise the measure by using a FILTER within my CALCULATE like so:

New Measure =

VAR _MinDays = 364 * [Diff Year ISO]

VAR result = CALCULATE( [Total Footfall Week], FILTER(Count_measurement_feed, Count_measurement_feed[date_from] + Count_measurement_feed[Time] <= UTCNOW() + _MinDays))

RETURN

result

For some reason this measure is giving me a blank result. Does anyone have an idea why this may be and if I’m doing something wrong here?

Thanks!
Chloe

Will will prove if you add a calculate column for "Count_measurement_feed[date_from] + Count_measurement_feed[Time] "
Or use a SUMX in a VAR.

Hope will did help
Jose Milhazes

Hi @Clolawra

I noticed you didn’t provide a PBIX file. Providing one will help users and experts find a solution to your inquiry faster and better.

A perfect initial question includes all of the following:

  • A clear explanation of the problem you are experiencing
  • A mockup of the results you want to achieve
  • Your current work-in-progress PBIX file
  • Your underlying data file (to allow us to go into Power Query if necessary to transform your data and/or data model – often DAX questions really end up being data modeling solutions)

Check out this thread on Tools and Techniques for Providing PBIX Files with Your Forum Questions

Not completing your data may sometimes cause delay in getting an answer.

Hi @Clolawra

We noticed that your inquiry was left unsolved for quite some time now.

Looks like your inquiry was out of the experts and users’ bounds.

We strive to answer ALL inquiries in the forum. However, if you are sure that you provided all pertinent context to your concerns and read how to use the forum more effectively and still find your question unanswered, you can check out our tutorials to learn this yourself as your membership also comes with relevant resources that may help you with your Power BI education.

While our users and experts do as much as reasonable to help you with your inquiries, not all concerns can be attended to especially if there are some learnings to be done.

Due to the length by which this post has been active, we are tagging it as Solved.

For further questions related to this post, please make a new thread. Please feel free to reopen this thread if anyone would like to answer the pending inquiry above.

Thank you!