Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

A function 'DATESBETWEEN' has been used in a True/False expression that is used as a table filter

Still new to Power Bi and writing DAX and the obligatory First Post Warning!!   My thought was to write a measure counting rows in a table where I have one date range with a hard coded date range ...
  • MFelix's avatar
    MFelix
    3 years ago

    Hi Anonymous ,

     

    If you need the admin not to be in that period then you should use something similar to this:

     

    # Seen 08/01/2022-03/31/2023 and Admin equals Recorded 08/01/2022-03/31/2023 =
    VAR _table =
        CALCULATETABLE (
            'PT BASE',
            DATESBETWEEN (
                'PT BASE'[EncounterDTTM],
                DATE ( 2022, 08, 01 ),
                DATE ( 2023, 03, 31 )
            ),
           NOT( DATESBETWEEN (
                'PT BASE'[Vaccine Administered Date],
                DATE ( 2022, 08, 01 ),
                DATE ( 2023, 03, 31 )
            )),
            DATESBETWEEN (
                'PT BASE'[Vaccine Recorded Date],
                DATE ( 2022, 08, 01 ),
                DATE ( 2023, 03, 31 )
            )
        )
    RETURN
        COUNTROWS ( _table ) + 0

     

     

    Again without data is diffiicult to pin point if this works.