[英]How do you filter a date table based on two separate date filters in PowerBI?
I have 3 tables StartDateSelect EndDateSelect and Date.我有 3 个表 StartDateSelect EndDateSelect 和 Date。 Date is what is driving my other table in the report.
日期是驱动我在报告中的其他表格的原因。
Note Date3 is formatted as 123ABC to show "Latest" for the latest date after refresh else show Date.注意 Date3 的格式为 123ABC,以在刷新后显示“最新”日期,否则显示日期。 This is to make sure that for each scheduled refresh, I will always have the filters show as the latest date so the user doesn't have to switch it each day.
这是为了确保对于每个计划的刷新,我将始终将过滤器显示为最新日期,这样用户就不必每天都切换它。
In my dashboard, I have two filters for date selection (start and End).在我的仪表板中,我有两个用于日期选择的过滤器(开始和结束)。 I have selected the dates I want as shown:
我已经选择了我想要的日期,如图所示:
I want the Dates table to be filtered for values BETWEEN the selected Start Date and Selected End Date (which in most cases will be stuck on "Latest")我希望过滤日期表以获取所选开始日期和所选结束日期之间的值(在大多数情况下将停留在“最新”上)
I've played with filters on visuals and index columns with no luck, and I can't seem to get this to work.我在视觉效果和索引列上玩过过滤器,但没有运气,我似乎无法让它工作。 Or if there's another way to do this.
或者,如果有另一种方法可以做到这一点。 The Between filter won't work with a word called "Latest" in it as it's ABC123 format by default.
之间过滤器不适用于其中的“最新”一词,因为它默认为 ABC123 格式。
Create a measure as follows.如下创建一个度量。
Measure =
VAR cursor = MAX('Date'[Dates])
VAR startDate = MAX(StartDatesSelect[Dates])
VAR endDate = MAX(EndDateSelect[Dates])
RETURN IF(cursor IN DATESBETWEEN('Date'[Dates], startDate, endDate),1,0)
Set a filter on your visual as follows:在您的视觉对象上设置过滤器,如下所示:
That's it.而已。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.