PowerBI-基于时间添加过滤器

PowerBI-add filter based on time

我的数据源是 SQL。事件发生时有一列包含 date/time。在 PowerBI 中,我想每周显示一个图表,说明该周发生了多少事件?将不胜感激帮助。

如果您使用任何类型的 date-data,您应该始终包含一个 date-table,其中包含每天的额外数据。

table 可能看起来像 [day, month-number, year-number, quarter-number, week-number, year-month, year-quarter、year-week、工作日、假日YN、...]。 year-month 或 year-week 列看起来像 2017-01、2017-02 等,因此当您使用日期范围时,您可以获得连续的时间序列 tables 和绘图,例如从 11 月到次年 2 月(因此排序为 A-Z,即 2016-11、2016-12、2017-01、2017-02 而不是 01、02、11、12)。您可以在 Excel 中创建并直接导入,或者使用 PowerBI-query 窗格中的数据转换功能。

此 table 然后会链接到 PowerBI-data 模型中的 [date] 列。

只要您现在想要显示,比方说,每周汇总的每日销售数据,您可以创建一个 table/plot,其中包含 sales-values 和 [year-week] 列dates-table.