locked
USERELATIONSHIP together with FILTER in CALCULATE does not work as expected RRS feed

  • Question

  • The following measure works fine.

    :=CALCULATE(COUNTROWS(tAnstallda);USERELATIONSHIP(tAnstallda[dateUntil];dimDate[date]))

    But the measure below, where I have added a filter, returns nothing. It does not work as expected. 

    :=CALCULATE(COUNTROWS(tAnstallda);USERELATIONSHIP(tAnstallda[dateUntil];dimDate[date]);FILTER(tAnstallda;tAnstallda[dateUntil]<>BLANK()))

    I want the USERELATIONSHIP function to change the relationship for the entire calculate function. But I am guessing that maybe the FILTER function is still using the default relationship? I'm just guessing. Hopefully you know what the problem is and have the skill to solve it.

    Thank you 


    Tuesday, September 15, 2015 10:41 AM

Answers

  • Hi JP3O,

    Indeed, the FILTER function operates on its own here. You can replace the FILTER statement with an easier filter like this:

    :=CALCULATE(COUNTROWS(tAnstallda);NOT(ISBLANK(tAnstallda[dateUntil]));USERELATIONSHIP(...))

    • Proposed as answer by Michael Amadi Wednesday, September 16, 2015 8:08 PM
    • Marked as answer by JP3O Thursday, September 17, 2015 7:43 AM
    Tuesday, September 15, 2015 11:13 AM
    Answerer