Power BI中的默认切片器选择(最新日期)

问题描述:

我的要求是,默认情况下将在Power BI服务中打开报表时,将在单个选择切片器中选择最新日期.

My requirement is when a report will be opened in Power BI services by default, the latest date will be selected in a single select slicer.

考虑在导入模式下,有10个日期即将到来并分配给切片器(单选下拉列表).默认情况下,它将较早的日期显示为选定日期.

Consider in import mode there are 10 dates are coming and assigned to a slicer (single select dropdown). By default it shows the older date as the selected date.

我需要做相反的事情.它应该是默认情况下选择的最新日期,如果用户要选择其他日期,则可以手动更改.默认情况下,我的目标网页应动态显示最新日期.

I need to do the opposite. It should be the latest date selected by default and if the user wants to select other dates they can change manually. My landing page by default should show the latest date dynamically.

无法自动在切片器中选择最新日期.但是,对此有一种解决方法,我在下面进行了解释.

It's not possible to select the latest date in slicer automatically. However, there is a kind of workaround for this which I have explained below.

只需使用原始日期创建一个附加列,如下所示:

Just create an additional column using original date like this:

Date 2 = IF('Table'[Date] = TODAY(), "Today", FORMAT('Table'[Date], "MM-DD-YYYY"))

然后使用您的切片器中的这个新创建的列,并在该切片器中手动选择一次今天",然后将该文件发布到Power BI服务.因此,最终用户将始终在默认情况下在切片器中始终看到今天",这显然代表了当前日期.

Then use this newly created column in your slicer and manually select 'Today' in that slicer once and publish the file to the Power BI service. So the end user will always see 'Today' selected in a slicer by default which obviously represents the current date.

注意:如果您希望选择的最新日期不一定是当前日期,则可以在下面创建列:

Date 2 = IF('Table'[Date] = MAX('Table'[Date]), "Latest Date", FORMAT('Table'[Date], "MM-DD-YYYY"))