Forum Discussion
Anonymous
4 years agoNot applicable
How to filter a table based on user input?
Example - if a user inputs date (from table 1), I need to filter table 2 by displaying all the rows which have the range of date to date - 13. I created a slicer and now I take the value that is ...
- 4 years ago
Hi Anonymous ,
No worries. Yes that can be done.
Just create a new measure like below :_val =var _sel = SELECTEDVALUE(dates[Dates])var _cond = if (MAX(SampleData[Date]) >= _sel-13 && MAX(SampleData[Date]) <= _sel , 1, 0)return_condThen add this measure as a filter on the visual and set its value to 1Kind regards,
Rohit
Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 🙂
Anonymous
4 years agoNot applicable
I'm not sure what I'm doing wrong. But when I do the same thing, I don't get the same results.
I even made the same dummy data as you did to check. I created _val in the second table
This is what happens.
I don't know why _dtmin and _dtmax are taking the selected dates because i did - _dtmin = MIN(SampleData[Date})
Can you tell me what I'm doing wrong please? Thank you
rohit_singh
4 years agoSolution Sage
Hi Anonymous ,
Create the measures as follows :
1) _dtmax = SELECTEDVALUE(dates[Dates])
2) _dtmin =
var _sel = [_dtmax]
var _mindt =
CALCULATE(
min(SampleData[Date]),
filter(SampleData,
SampleData[Date] = _sel -13
)
)
Return
_mindt
3) _val =
var _sel = SELECTEDVALUE(dates[Dates])
var _cond = if (MAX(SampleData[Date]) >= _sel-13 && MAX(SampleData[Date]) <= _sel , 1, 0)
return
_cond
- Anonymous4 years agoNot applicable
Hey, thanks for the reply. I did exactly as told. But even then when I select 27th, I see all the values.