Forum Discussion
Filter daterange
Hello
Sorry if this has been already answered, but I could not find the answer easily.
I have two tables. Ther is no relationship between them.
I would like to filter rows from Table2 where the Date value is between From and To values selected in Table1
Table1
| From | To |
| 24.Aug.2020 | 30.Sept.2020 |
| 23.July.2020 | 23.August.2020 |
Table2
| Project | Invoice | Date |
| Proj1 | $10 | 25.Aug.2020 |
| Proj2 | $50 | 29.Sept.2020 |
| Proj1 | $20 | 22.Aug.2020 |
Once the user selects a row in Table1 then the only rows from Table2 within From/To Range are displayed.
- user selects row: Table1, From:24.Aug.2020,To:30.Sept.2020
- Only the Dates 25.Aug.2020 and 29.Sept.2020 are displayed
What meassure should I create to achieve this?
Thank you
Peter
Hi peter_jak ,
You need to create a measure and add it to the filter panel as a condition.
Please use this measure:
IsSelectedPeriod = VAR __StartDate = MIN(Table1[From]) VAR __EndDate = MAX(Table1[To]) VAR __ProjectDate = MAX(Table2[Date]) RETURN IF( __ProjectDate >= __StartDate && __ProjectDate <= __EndDate, 1, 0 )and add it to the visual filter for Table2:
The result:
_______________
If I helped, please accept the solution and give kudos! 😀
2 Replies
- lkalawski
Resident Rockstar
Hi peter_jak ,
You need to create a measure and add it to the filter panel as a condition.
Please use this measure:
IsSelectedPeriod = VAR __StartDate = MIN(Table1[From]) VAR __EndDate = MAX(Table1[To]) VAR __ProjectDate = MAX(Table2[Date]) RETURN IF( __ProjectDate >= __StartDate && __ProjectDate <= __EndDate, 1, 0 )and add it to the visual filter for Table2:
The result:
_______________
If I helped, please accept the solution and give kudos! 😀 - peter_jakRegular Visitor
Thank you very much for quick and good solution. It works