Forum Discussion

vtech007's avatar
vtech007
Frequent Visitor
1 year ago
Solved

Filtering Contracts based on expiring Period by months

Dear Colleagues,   I would like to create an IF-parameter slicer button with three categories, allowing users to filter contracts based on their expiry periods: Contracts Expiring in Less Than 3...
  • MattiaFratello's avatar
    1 year ago

    Hi vtech007, have you tried to create a calculated column and then use it as a filter? 

     

    Expires In = 
    VAR CurrentDate = TODAY()
    VAR Expiration_Date = YourTable[Contract_End_Date]
    VAR MonthsDiff = DATEDIFF(CurrentDate, Contract_End_Date, MONTH)
    
    RETURN
        SWITCH(
            TRUE(),
            MonthsDiff <= 3, "Expires in the next 3 months",
            MonthsDiff <= 6, "Expires in the next 6 months",
            MonthsDiff <= 12, "Expires in the next 12 months"
            )

     

     

    You can then activate the select all option from your slicer

     

    If it helped you please mark it as solution