Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

AND OR in Filter

I have a small issue and do not seem to get the DAX code correct.
Need to know the amount of flats occupied.
For this i do a count of contractid and i want to match 2 dates
Date 1 = DatumInHuizing (The date that they start living at us)
Date 2 = DatumUitHuizing (The date that they move out)
So Date 2 can be a date or be empty combining AND and OR gives always errors, the DAX below is without the OR part 😞
FlatsBezetPerDatum = CALCULATE(COUNT('Bewoners_Contracten (Sharepoint)'[ContractId]),FILTER('Bewoners_Contracten (Sharepoint)','Bewoners_Contracten (Sharepoint)'[DatumInHuizing]>= FIRSTDATE(DateTable[Date])&&('Bewoners_Contracten (Sharepoint)'[DatumuithuizingZonderNull]<=LASTDATE(DateTable[Date]))))
Community Support
Community Support

@SvenJacobs ,

Could you  pls share your pbix  and result you want to display ?I need data to test .Remember to remove confident data.


Best Regards


Super User
Super User


Please try:

FlatsBezetPerDatum =
VAR __startdate =
    FIRSTDATE ( DateTable[Date] )
VAR __enddate =
    LASTDATE ( DateTable[Date] )
        COUNT ( 'Bewoners_Contracten (Sharepoint)'[ContractId] ),
        FILTER (
            'Bewoners_Contracten (Sharepoint)',
            'Bewoners_Contracten (Sharepoint)'[DatumInHuizing] >= __startdate
                && ( 'Bewoners_Contracten (Sharepoint)'[DatumuithuizingZonderNull] <= __enddate )
        'Bewoners_Contracten (Sharepoint)'[DatumInHuizing] <> BLANK()
Did I answer your question? Mark my post as a solution! and hit thumbs up

Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Frequent Visitor

The 2 DAX codes seem to work only I guess my thinking is not correct..... Why because if I have 100 flats i can not. Need to figure out how your HR thing worked. Because I want to know on a specific date in time the amount of flats that wher rented out.


Super User
Super User

@SvenJacobs  Are you trying to find active between the start and end date. Refer to this example

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Helpful resources

PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!