Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
PowerPaddy
Frequent Visitor

Count of Rows that fall within a date range

Hello, I'm really strugging with a dax expression that seems like it should be fairly simple.

I have a table of Insurance Policies, 1 row for each policy. Each row has a POLICYSTARTDATE and POLICYENDDATE.
I want to show a daily/monthly count of Live policies, ie choose a date and display the number of rows for which that date falls within POLICYSTARTDATE and POLICYENDDATE.

Any help greatly appreciated.

2 REPLIES 2
MFelix
Super User
Super User

Hi @PowerPaddy,

 

Check this Post the answer should by preety similar to what I gave.

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Zubair_Muhammad
Community Champion
Community Champion

@PowerPaddy

 

Try this measure

 

Adjust the mydate according to your needs. You can link it to a slicer as well

 

Measure =
VAR mydate =
    DATE ( 2017, 1, 22 )
RETURN
    COUNTROWS (
        FILTER (
            ADDCOLUMNS (
                TableName,
                "Live/Dead", IF (
                    mydate >= TableName[Policy Start Date]
                        && mydate <= TableName[Policy End Date],
                    "Live",
                    "Dead"
                )
            ),
            [Live/Dead] = "Live"
        )
    )

 


Regards
Zubair

Please try my custom visuals

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.