ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 Excel Home精品图文教程库
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
300集Office 2010微视频教程 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
查看: 3142|回复: 1

[分享] 一个Dax日期表模板

[复制链接]

TA的精华主题

TA的得分主题

发表于 2018-2-21 13:39 | 显示全部楼层 |阅读模式
本帖最后由 lee_tao57 于 2018-2-23 11:05 编辑

Italians在他们的官网上发布了一个有用的工具,Dax日期模板。该模板对于Dax建模特别是在Power BI环境下的建模非常有帮助。

相关Italians的文章《
Reference Date Table in DAX and Power BI 》也对该工具的使用做了详尽说明。

该文第一段编译如下,共朋友参阅。

PowerBI中所提供的自动日期/时间功能存在着下列几个限制:

  • 它有一个固定的行集
  • 不处理财务年度
  • 不包括星期
  • 在同一数据模型中不能在不同表中共享

通常情况,需要禁用该功能并创建自定义日期表,这项工作既重复又耗时。由包含全功能日期表的PowerBI模板开始创建新的Power BI模型,可免除用户编写DAX表达式的需求,并设置必要的属性用以定义报表和计算中显示格式、层次结构和可视性所需要的列。


日期表模板中的快速说明中英文对照如下。

Quick instructions

The template contains three calendars with different prefixes:

- Calendar is the standard Gregorian calendar based on months, starting on January 1st and
ending on December 31st

- Fiscal is a fiscal calendar based on months, based on FiscalCalendarFirstMonth setting

- FW is a weekly fiscal calendar, where each year has 52-53 weeks, configured using the FirstDayOfWeek, WeeklyType and QuarterWeekType settings

You can remove the columns that you don't need by modifying the last part of the
formula (remove rows in the last SELECTCOLUMNS statement). If you change your mind and you want to include columns that you removed, it is better that you start from the template file, so you will recover the initial settings (format, hierarchies, visibility, aggregation type) of all the columns.

You can change the prefixes of the content of the column in the parameters.
You can define custom fiscal periods in FW calendar
instead of the standard ones you can obtain with the standard parameters.

Read the comments in the DAX expression used for the Date calculated table and
adjust the settings according to your needs.
Most of the hidden columns available in the model are useful for calculations or
special reports.

Documentation about intended use of the Date table columns available at:

快速说明

该模板包含具有三个不同前缀的日历:

- Calendar是基于月份的标准公历日历,从1月1日起始到12月31日结束

- Fiscal是基于月份的财务日历,由根据FiscalCalendarFirstMonth设置

- FW是每周财务日历,每年有52-53周,配置采用FirstDayOfWeek、WeeklyType和QuarterWeekType设置来实施

通过修改公式的最后部分,可以删除不需要的列(删除最后一个SELECTCOLUMNS语句中的行)。如果你改变了主意想要包含已删除的列,最好从模板文件开始,以便恢复所有列的初始设置(格式、层次结构、可视性、聚合类型)。

你可以更改参数中列内容的前缀。你可以在FW日历中定义自定义财务周期,而取代使用标准参数获得的标准周期。

阅读用于日期计算表DAX表达式中的注释,并根据你的需要调整设置。模型中提供的大多数隐藏列可用于计算或特殊报告中。

有关涉及使用日期表列的文档可在以下网址获取:https://www.sqlbi.com/articles/reference-date-table-in-dax-and-power-bi/










TA的精华主题

TA的得分主题

 楼主| 发表于 2018-2-21 19:20 | 显示全部楼层
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

关闭

最新热点上一条 /1 下一条

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2024-4-24 18:14 , Processed in 0.037929 second(s), 7 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

快速回复 返回顶部 返回列表