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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
lancemac_1
Frequent Visitor

Dynamically calculate count of insurance that are about to expire based on date range from slicer

I have a column insurance_exp_date which contains expiry dates form which i want to count the based on the date slicer which will be the ones that are expiring in next 30 days, the ouput can be the count of the insurance_exp_date or can be flagged.
but when I am using the slicer i get wrong values 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @lancemac_1 ,

 

You might consider creating an un-connected table to hold all the values of the slicer.

 

Table = CALENDAR(<StartDate>,<EndDate>)

 

Then create a measure like:

 

Measure =
VAR _selected_date =
    MAX ( 'Table'[Date] )
VAR _30days_date = _selected_date + 30
VAR _count =
    CALCULATE (
        COUNTROWS ( 'YourTableName' ),
        'YourTableName'[insurance_exp_date] >= _selected_date
            && 'YourTableName'[insurance_exp_date] <= _30days_date
    )
RETURN
    _count

 


Now, you can use the measure in your visuals to display the count of insurance policies expiring in the next 30 days. If you're still experiencing issues with the slicer, please provide more information about your data model and the slicer configuration, so I can better understand the problem and help you find a solution.

 

How to Get Your Question Answered Quickly - Microsoft Fabric Community

How to provide sample data in the Power BI Forum - Microsoft Fabric Community

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @lancemac_1 ,

 

You might consider creating an un-connected table to hold all the values of the slicer.

 

Table = CALENDAR(<StartDate>,<EndDate>)

 

Then create a measure like:

 

Measure =
VAR _selected_date =
    MAX ( 'Table'[Date] )
VAR _30days_date = _selected_date + 30
VAR _count =
    CALCULATE (
        COUNTROWS ( 'YourTableName' ),
        'YourTableName'[insurance_exp_date] >= _selected_date
            && 'YourTableName'[insurance_exp_date] <= _30days_date
    )
RETURN
    _count

 


Now, you can use the measure in your visuals to display the count of insurance policies expiring in the next 30 days. If you're still experiencing issues with the slicer, please provide more information about your data model and the slicer configuration, so I can better understand the problem and help you find a solution.

 

How to Get Your Question Answered Quickly - Microsoft Fabric Community

How to provide sample data in the Power BI Forum - Microsoft Fabric Community

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Solution Authors