Forum Discussion
Help with Count with Filters
Hello! I have been reading other solutions for filtering in count measures but so far no luck with mine. Here is my code for a measure:
Total active facilities = CALCULATE(DISTINCTCOUNT('FFAFacilities'[FACILITY_ID]),FILTER('FFAFacilities','FFAFacilities'[CURRENT_STATUS]="01"))
The code doesnt like the filter. It is a string and I tried copying the column and making it a whole number and then filtering it by the value 1 but that also did not work. I also tried all different variations of count so it has something to do with the filter value. Any suggestions would be awesome.
Thanks!
Hi janegrnisppl ,
Where do you want to apply this measure to? This measure may be affected by the context.
Based on your description, I have created a simple sample:
Please try something like:
Total active facilities = CALCULATE(DISTINCTCOUNT('FFAFacilities'[FACILITY_ID]),FILTER(ALL('FFAFacilities'),'FFAFacilities'[CURRENT_STATUS]="01"))Final output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- rsbinCommunity Champion
Can you please post a small sample of your FFAFacilities table or attach your pbix file after removing sensitive data.
- v-jianboli-msftCommunity Support
Hi janegrnisppl ,
Where do you want to apply this measure to? This measure may be affected by the context.
Based on your description, I have created a simple sample:
Please try something like:
Total active facilities = CALCULATE(DISTINCTCOUNT('FFAFacilities'[FACILITY_ID]),FILTER(ALL('FFAFacilities'),'FFAFacilities'[CURRENT_STATUS]="01"))Final output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.