Forum Discussion

Harmen's avatar
Harmen
Regular Visitor
3 years ago
Solved

Dax

Hello, I have a dax question, how to countrows where filter is a reference date between to dates. With the next dax expression i count rows where the reference date (today) is between the startingdat...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Harmen ,

    I created a sample pbix file(see the attachment), please check if that is what you want.

    1. Create adate dimension table as below and apply the date field of this date dimension table on the slicer

    Date = CALENDARAUTO()

    2. Update a measure as below to get it:

    Peildatum =
    VAR _seldate =
        SELECTEDVALUE ( 'Date'[Date] )
    RETURN
        CALCULATE (
            COUNTROWS ( 'Uitkeringsgegevens' ),
            FILTER (
                'Uitkeringsgegevens',
                ( 'Uitkeringsgegevens'[startdate] <= _seldate
                    && 'Uitkeringsgegevens'[Enddate] > _seldate )
            )
        )

    If the above one can't help you get the desired result, please provide some raw data in your table 'Uitkeringsgegevens' (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

    How to upload PBI in Community

    Best Regards