Power BI 中的默认切片器选择(最新日期) [英] Default slicer selection (latest date) in Power BI

查看:410
本文介绍了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"))

这篇关于Power BI 中的默认切片器选择(最新日期)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆