Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Active Policy ID

Hi 

I wanted to create Count of  Active policy numbers using dax
I have a calendar table  & another table i am having Start date & End Date along with Policy Number refer below image

 


In my report view i have year slicer and Month Selection 
It is created based on the above start date and End date  so it contains values from 2022 to 2023

Scenario : If i select 2022 from year slicer and  January from Month slicer 
BASE ON THE ABOVE IMAGE 3 POLICY ARE ACTIVE 

 

The policy ID 123, 342 is straight forward but policy 125 also should be Active that is the requirment
Because  policy number 125 also coming under on this range itself (2023)

How can we achive this logic in dax ,
Appreciate help on this 

 

2 Replies

  • Try a measure like this:

    Active = 
    var dateRange = CALCULATE(MIN('Calendar'[Date]), ALLSELECTED('Calendar'[Date]))
    return IF(SELECTEDVALUE('Table'[Start]) <= dateRange && SELECTEDVALUE('Table'[End]) >= dateRange, "Active", "Inactive")

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    There are some things I don't understand too much. Why choose 2022 and January, but Policy ID 342 is active. 

    The date range for ID 342 is 2023-1-1 to 2023-12-31. January 2022 is not in this range.

                                                                                                                                                        

    Best Regards,

    Stephen Tao

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.