cancel
Showing results 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

Frequent Visitor

## Altering evaluation context - return table ignoring current filter context in measure

Hi everyone,

I'm looking to the community to see if I can get help understanding how to make the below measure work:

Problem I'm solving for: Count all the Tasks that happened between two dates (defined in a slicer), plus 30 days after the max date.

Current code for Measure:

``````# of SAs + 30: =
var minDate = MIN(dimDate[Key Date])
var maxDate = MAX(dimDate[Key Date]) + 30
) */
RETURN
CALCULATE(
[# of SAs:],
)
)``````

Code for [# of SA's] (used in above measure):

``````# of SAs: = CALCULATE(
TREATAS(
VALUES(factCampaignMember[Case_Safe_ID__c]),
)
)``````

Current ERD:

Any help would be greatly appreciated !

1 ACCEPTED SOLUTION
Super User

One thing you can try

``````# of SAs + 30: =
var minDate = MIN(dimDate[Key Date])
var maxDate = MAX(dimDate[Key Date]) + 30
) */
RETURN
CALCULATE(
[# of SAs:],
FILTER(ALL(dimDate),
VALUE(dimDate[Key Date]) >= minDate &&
VALUE(dimDate[Key Date]) <= maxDate
)
)``````
4 REPLIES 4
Super User

One thing you can try

``````# of SAs + 30: =
var minDate = MIN(dimDate[Key Date])
var maxDate = MAX(dimDate[Key Date]) + 30
) */
RETURN
CALCULATE(
[# of SAs:],
FILTER(ALL(dimDate),
VALUE(dimDate[Key Date]) >= minDate &&
VALUE(dimDate[Key Date]) <= maxDate
)
)``````
Frequent Visitor

Thank you !  This appears to worked, as now I am seeing some logical results from the measure:

Super User

I would try getting rid of your VALUE statements I don't understand why you are using those. Also, maybe just ALL of your table instead of specifying a particular column.

Become an expert!: Enterprise DNA
External Tools: MSHGQM
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Frequent Visitor

Thanks Greg, I removed VALUES() and used a table expression instead of a column expresion in my ALL() statement, which returned some valid values for some records and incorrect values for others.

Ideally [# of SAs + 30] should be equal to or greater than [# of SA's]: