简体   繁体   English

如何根据 PowerBI 中的两个单独的日期筛选器筛选日期表?

[英]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.

相关问题 如何在表格中插入日期? - How do you insert a date in a table? 如何使用删除功能根据表中的最大日期从Oracle表中删除行? - How do you remove rows from an Oracle table based on the maximum date in the table using delete? 如何使用日期过滤器更改 Google Sheets 查询数据透视表中的日期格式? - How do I change the date format in a Google Sheets query pivot table with date filters? 您如何从现有表格中调用最新日期? - How do you call the latest date from existing table? 如何基于单独的日期和时间组件创建Oracle日期? - How to create an Oracle date based on separate date and time components? 在 Access 数据库上使用 VBscript 和 SQL 你如何根据日期与今天的日期比较 select 记录 - Using VBscript and SQL on an Access database how do you select records based on a date comparison with todays date 您如何在Java中比较日期,上一个日期和将来的日期? - How do you compare date, previous date and future date in Java? 坚持基于来自两个单独数组的日期构建对象 - Stuck with building an object based on date from two separate arrays 如何在 SQL 中的某些情况下根据日期进行过滤? - How to filter based on date in certain cases in SQL? 如何根据 JavaScript 中的日期过滤 HTML 数据? - How to filter HTML data based on date in JavaScript?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM