在 Power BI 中设置移动默认开始和结束日期 [英] Setting moving default start and end Date in power BI

查看:129
本文介绍了在 Power BI 中设置移动默认开始和结束日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个需要两周前的默认开始日期和今天的结束日期的 Power BI 报表.但是,我还希望用户根据需要从切片器中选择其他日期范围.有没有办法使用 Power BI 切片器实现它?

I have a power BI report that need A default start date of two weeks ago and end date of Today. However, I also want the user to select other date ranges from the slicer if they want. Is there a way I can achieve it with power BI slicer?

如果是,我该怎么做?

推荐答案

你需要一个第二个切片器来在你的默认日期周期(单独的日期表)和一个自定义日期期间.

You need a second slicer to switch between your default date period (separate date table) and a custom date period.

Date Periods = 
UNION(
    ADDCOLUMNS(
        DATESBETWEEN('Calendar'[Date], TODAY() - 13, TODAY()),
        "Type", "Default"
    ADDCOLUMNS(
        CALENDAR(MIN('Calendar'[Date]),MAX('Calendar'[Date])),
        "Type", "Custom"
    )
)

另外,您需要一个度量来根据选择过滤您的第一个切片器.

Plus you need a measure to filter your first slicer depending on the selection.

Slicer Filter = 
IF(
    SELECTEDVALUE('Date Periods'[Type]) = "Custom",
    1,
    0
)

这篇关于在 Power BI 中设置移动默认开始和结束日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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