Forum Discussion
How to filter a table based on user input?
- 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! 🙂
Hi Anonymous,
You can try something like this based on the sample data below:
Table 1
Table 2
Create a measure on Table 2 that takes the selected value from Table 1 and filters Table 2 using that.
Kind regards,
Rohit
Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 🙂
Hey, thank you so much for replying!
I see what you've done. Is there anyway to get 14 - 27th dates in a table according to your example above?
- rohit_singh4 years agoSolution Sage
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! 🙂- Anonymous4 years agoNot applicable
Thank you so much! I'm going to try this out right now!
- Anonymous4 years agoNot applicable
Also, if I had to save this filtered table and then join with another table and display that in the report - can I do that?
so, everytime a user selects a date, I filter the table and perform a join with another table and display that in the report. Is this possible?- rohit_singh4 years agoSolution Sage
Hi Anonymous ,
You don't need to save the table. You can smply create a relationship between Table2 and the other table and drag and drop columns from the other table into your visual. The values in the otehr table will be filtered automatically based on the relationship you've created.
Kind regards,
Rohit
- Anonymous4 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_singh4 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_mindt3) _val =var _sel = SELECTEDVALUE(dates[Dates])var _cond = if (MAX(SampleData[Date]) >= _sel-13 && MAX(SampleData[Date]) <= _sel , 1, 0)return_cond