Forum Discussion
Dynamic parameter selection for due days
- 1 year ago
Create a numeric parameter ranging from 1 to the maximum number of days you want to be able to filter for. Then create a measure like
Closure date within X days = VAR ChosenDays = [Num Days Value] VAR RefDate = SELECTEDVALUE ( 'Table'[Closure Date] ) VAR DaysDiff = DATEDIFF ( TODAY (), RefDate, DAY ) VAR Result = IF ( DaysDiff <= ChosenDays, 1 ) RETURN ResultAdd that measure as a filter to your table or matrix visual, set to show only when the value is 1.
Create a numeric parameter ranging from 1 to the maximum number of days you want to be able to filter for. Then create a measure like
Closure date within X days =
VAR ChosenDays = [Num Days Value]
VAR RefDate =
SELECTEDVALUE ( 'Table'[Closure Date] )
VAR DaysDiff =
DATEDIFF ( TODAY (), RefDate, DAY )
VAR Result =
IF ( DaysDiff <= ChosenDays, 1 )
RETURN
Result
Add that measure as a filter to your table or matrix visual, set to show only when the value is 1.
- nish18_19901 year agoHelper III
Could you please attach the power bi file for reference
- johnt751 year agoSuper User
Here you go
- nish18_19901 year agoHelper III
Its not working if i select any numbers , its showing same date .
- nish18_19901 year agoHelper III
Sorry i did tried it but its not working . I am getting 1 value even if i select any number on parameter . I need like if i select 20 on parameter . It should show categories having closure date in next 20 days from today .
- nish18_19901 year agoHelper III
This calculation worked but i need to change it a bit as it will give past dates than today as well. I included >today in and condition for Var Result.