Forum Discussion
Rows between two dates
- Anonymous5 years ago
Hi MrMike ,
Here are the steps you can follow:
1. Create measure.
Flag1 = var _selectedperiod= SELECTCOLUMNS(ALLSELECTED('date'),"Date", [Date]) return IF(MAX('Table'[Start Date]) in _selectedperiod||MAX('Table'[End Date]) in _selectedperiod|| (MAX('Table'[Start Date])<=MIN('date'[Date])&&MAX('Table'[End Date])>=MAX('date'[Date])) ,1,0)2. Result
You can downloaded PBIX file from here.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi MrMike ,
Here are the steps you can follow:
1. Created a calendar table using calculated table
date = CALENDARAUTO( )2. Create measure.
Flag1 =
var _selectedperiod=
SELECTCOLUMNS(ALLSELECTED('date'),"Date", [Date])
return
IF(MAX('Table'[Start Date]) in _selectedperiod||MAX('Table'[End Date]) in _selectedperiod,1,0)3. Set Flag1 is 1. in Filter.
4. Result:
You can downloaded PBIX file from here.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
There is still a problem. I added a new row to the table Start Date 1/1/2021 End Date 12/1/2021 Course: Gym
When I select Start Date 2/1/2021 and End Date 3/1/2021 only Math, Science and English show (better than before but still not working) because I expect to see 4 classes now: Math, Science, English and Gym (the new row I added).
Thank you for providing the PBIX file that helped. So again, I added a new row to your table and it should show in the visualization table when I select Start Date 2/1/2021 and End Date 3/1/2021 because the new row Gym goes for the whole year. The new row does show when I select 1/1/2021 and End Date 12/1/2021
Seems the dax code is only looking at the max start date and max end date but should be equal to or greater than start date and equal to or less than end date. How do I code that?
- MrMike5 years agoHelper II
Hello? Can anyone help me? This problem has NOT been fixed. I feel we are close to a solution.