仗剑走天涯

Just Do It!
随笔 - 61, 文章 - 0, 评论 - 0, 阅读 - 69865
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

如何使用Power BI的CALENDARAUTO()函数

Posted on   三颗油  阅读(108)  评论(0编辑  收藏  举报

First, you should be aware of the CALENDARAUTO() is a predefined function that is used to auto-generate calendar dates range based on a date field in the current model. So if the current model doesn't have a table with a date field you will get CALENDARAUTO function can not find a base column of DateTime type in the model.

Fixing CALENDARAUTO function can not find a base column of DateTime type in the model.

If you don't have any table that holds a date field in your current model, you can easily create a new table with a date field like the following:

  • On the Home tab, click on the Enter Data button to create a new table.
    enter data in power bi
  • The new table dialog will be shown.
  • Rename the column header as you prefer, and provide a meaningful table name, then add the date values in the correct format.
  • Click load to load the new table.
    create a new table in power bi
  • Now, create a new table based on CALENDARAUTO() function.
  • Great, the new calendar date table has been created based on the provided date range in your date newly table that you have created
    create a new table in power bi

You can also create a date table range using CALENDAR DAX function as mentioned at How to use DAX Calendar function in Power BI?

How CALENDARAUTO() works in Power BI

The CALENDARAUTO() generates a full year date range based on the date field in the current model.

  • The start date would be based on the minimum date in the current model.
  • The end date would be based on the maximum date in the current model.

Example:

  • Consider you have a date field with the below values
    date range in power bi

  • So the generated calendar table will hold a date range for three years from 01/01/2018 to 31/12/2020 as shown below:
    3 years calendar date table

    参考原文:
    https://www.debug.to/899/calendarauto-function-can-not-find-a-base-column-of-datetime-type-in-the-model#:~:text=Fixing%20CALENDARAUTO%20function%20can%20not%20find%20a%20base,Enter%20Data%20button%20to%20create%20a%20new%20table.
    https://devoworx.net/power-bi-dax-calenderauto/
相关博文:
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
点击右上角即可分享
微信分享提示