Forum Discussion
Need help filtering data using DAX & TimeSlicer,
- 4 years ago
Hi, Anonymous
Please try follow steps:
1.create measue as below:lastdate = VAR D1 = DATE ( 2021, 05, 01 ) RETURN CALCULATE ( MAX ( User[Date] ), FILTER ( ALLEXCEPT ( User, User[User] ), User[Date] <= D1 ) ) //Group by user and get max date less than or equal to current datevisual filter = IF(SELECTEDVALUE(User[Date])=[lastdate],1,0)2.then drag the measure 'visual filter' to the filter panle of this table visual as below:
Best Regards,
Community Support Team _ Eason
Hi,
When you write: " Let say for exemple that we are in July 2021, i want to filter the table to only keep the following lines:
User1, 01/01/2021, Val2
User2, 01/02/2020, Val1
User3, 01/06/2021, Val3", could you you explain your filtering logic (the criteria of filtering)? If the criteria of filtering are clear, we can help you.
Best regards.
To clarify the criteria.
This is a table with historical data.
When you made calculation base on the table, you set a date [dt1] somewhere in the past.
The line to apply then for each user is the first one older to [dt1].
So if I come back to my example, with a [dt1] set to 5/1/2021, you will keep in final result only those lines:
01/01/2021,User1,Val2
01/02/2020,User2,Val1
01/04/2021,User3,Val2
Hopes it make it clearer like this.
- v-easonf-msft4 years ago
Community Support
Hi, Anonymous
Please try follow steps:
1.create measue as below:lastdate = VAR D1 = DATE ( 2021, 05, 01 ) RETURN CALCULATE ( MAX ( User[Date] ), FILTER ( ALLEXCEPT ( User, User[User] ), User[Date] <= D1 ) ) //Group by user and get max date less than or equal to current datevisual filter = IF(SELECTEDVALUE(User[Date])=[lastdate],1,0)2.then drag the measure 'visual filter' to the filter panle of this table visual as below:
Best Regards,
Community Support Team _ Eason- Anonymous4 years agoNot applicable
Hello,
Sorry for the delay in my response, was on another stuff last weeks.
I test your solution today, it works great.
Exactly what I need.
Thanks a lot,Laurent.