Forum Discussion
Record count using calendar date table
- 7 years ago
If you want to do a "between" style of join like this you can't really use relationships (in fact they will cause issues). So you could either remove them entirely or use the CROSSFILTER() function to switch them off for this measure as I have done below. A pattern like the following should give you what you want
Active Producers = CALCULATE ( COUNTROWS ( FILTER ( Producer, Producer[Prod First Ship Date] <= MAX ( 'Prod First Ship Date Calendar'[Prod First Ship Date] ) && ( ISBLANK ( Producer[Prod Term Date] ) || Producer[Prod Term Date] > MAX ( 'Prod First Ship Date Calendar'[Prod First Ship Date] ) ) ) ), CROSSFILTER ( Producer[Prod First Ship Date], 'Prod First Ship Date Calendar'[Prod First Ship Date], NONE ) )
If you want to do a "between" style of join like this you can't really use relationships (in fact they will cause issues). So you could either remove them entirely or use the CROSSFILTER() function to switch them off for this measure as I have done below. A pattern like the following should give you what you want
Active Producers =
CALCULATE (
COUNTROWS (
FILTER (
Producer,
Producer[Prod First Ship Date] <= MAX ( 'Prod First Ship Date Calendar'[Prod First Ship Date] )
&& (
ISBLANK ( Producer[Prod Term Date] )
|| Producer[Prod Term Date] > MAX ( 'Prod First Ship Date Calendar'[Prod First Ship Date] )
)
)
),
CROSSFILTER ( Producer[Prod First Ship Date], 'Prod First Ship Date Calendar'[Prod First Ship Date], NONE )
)- esuing7 years agoHelper I
This worked great! As a beginner, I knew I need to use the CROSSFILTER function within my CALCULATE but didn't know where it made sense (inside the FILTER or not).
Thanks!
Eric