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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Dynamic date range slicer with only the max date (end date) selected and ignoring the min date.


How can I adjust my Power BI measure to calculate the total number of inactive clients beyond two years, based on the maximum date selected in a date range slicer, while ignoring the minimum date? For example, if the date range selected is from 1/1/2021 to 1/1/2022, the measure will show blank values since the selected range is less than 2 years. Instead, I want it to consider the maximum date selected (1/1/2022) and calculate the total from that date back to two years (1/1/2020) even if it's not included in the slicer

Here is the measure
InactiveClients_Beyond2Years =
CALCULATE(
COUNTROWS(
FILTER(
VALUES(SQL_Database_Website[NTID]),
CALCULATE(MAX(SQL_Database_Website[SubmitDate])) <= MAX(SQL_Database_Website[SubmitDate]) - 730
)
),
ALLSELECTED(SQL_Database_Website[SubmitDate])

 

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@Anonymous 
Please try this meaure:

InactiveClients_Beyond2Years =
VAR __CurrentDate =
    MAX ( SQL_Database_Website[SubmitDate] )
VAR __PrevDate =
    EDATE ( __CurrentDate, -24 )
VAR __Result =
    CALCULATE (
        DISTINCTCOUNT ( SQL_Database_Website[NTID] ),
        SQL_Database_Website[SubmitDate] >= __PrevDate,
        SQL_Database_Website[SubmitDate] <= __CurrentDate
    )
RETURN
    __Result
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

1 REPLY 1
Fowmy
Super User
Super User

@Anonymous 
Please try this meaure:

InactiveClients_Beyond2Years =
VAR __CurrentDate =
    MAX ( SQL_Database_Website[SubmitDate] )
VAR __PrevDate =
    EDATE ( __CurrentDate, -24 )
VAR __Result =
    CALCULATE (
        DISTINCTCOUNT ( SQL_Database_Website[NTID] ),
        SQL_Database_Website[SubmitDate] >= __PrevDate,
        SQL_Database_Website[SubmitDate] <= __CurrentDate
    )
RETURN
    __Result
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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