Table relationship to ensure table filters with the date slicer when the dates in table overlap

僤鯓⒐⒋嵵緔 提交于 2020-04-30 11:07:31

问题


I have a table Staff Booking containing Start date and End Date for a job. I also have a calculated table filed with

Date Range 2 = CALENDAR(MIN('Staff Booking'[Start Date]), MAX('Staff Booking'[End Date])) 

I want to eventually make a relationship between these two table such that:

1) When the date slicer range is defined, the jobs that overlap the slicer are filtered (using the start dat and end date columns)

2) And for the jobs that overlap, if the start date < min(slicer date) then start date change to min(slicer date)


回答1:


You can add a measure to the Staff Booking 2 table:

InRange = if(max('Date Range 2'[Date]) >= max('Staff Booking'[Start Date]) && MIN('Date Range 2'[Date]) <= min('Staff Booking'[End Date])),1,0)

As axample I added the InRange measure to the visual but as last step you can filter not on the InRange column by only taking the once which are 1.



来源:https://stackoverflow.com/questions/60943466/table-relationship-to-ensure-table-filters-with-the-date-slicer-when-the-dates-i

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!