Forum Discussion
Active relationship causing count to be wrong
If anyone can help I'd be enternally grateful.
Hi Anonymous
first you have to deactivate the active relationship. Or otherwise you need add REMOVEFILTERS ( DateQuery ) with CALCULATE to the following code which considers the property empty only if it is epmty in the whole period.
Count of property empty = COUNTROWS ( FILTER ( hraptvpd, hraptvpd[prev_tency_end] < MIN ( DateQuery[Date] ) && hraptvpd[next_tency_st] > MAX ( DateQuery[Date] ) ) )
12 Replies
- Greg_Deckler
Community Champion
Anonymous Maybe:
Count of property empty = CALCULATE( COUNT(hraptvpd[prev_tency]), USERELATIONSHIP(hraptvpd[prev_tency_end], DateQuery[Date]), DATESBETWEEN(DateQuery[Date], hraptvpd[prev_tency_end], hraptvpd[next_tency_st]) )- AnonymousNot applicable
- tamerj1
Community Champion
Anonymous
Hi Dan
kindly share a screenshot of the data model tab
- AnonymousNot applicable
Please ignore the mess. You wouldn't want to see the rest. 😛
1. is hraptvpd[next_tency_st] to DateQuery[Date] (this is active)
2. is hraptvpd[prev_tency_end] to DateQuery[Date] (this is inactive)
3. is hraptvpd[act_end_dt] to DateQuery[Date] (this is inactive)
- tamerj1
Community Champion
Hi Anonymous
first you have to deactivate the active relationship. Or otherwise you need add REMOVEFILTERS ( DateQuery ) with CALCULATE to the following code which considers the property empty only if it is epmty in the whole period.
Count of property empty = COUNTROWS ( FILTER ( hraptvpd, hraptvpd[prev_tency_end] < MIN ( DateQuery[Date] ) && hraptvpd[next_tency_st] > MAX ( DateQuery[Date] ) ) )