简体   繁体   English

Power BI DAX,月末不适用于日期表

[英]Power BI DAX, END OF MONTH DOESN'T WORK WITH DATE TABLE

When using endofmonth dax statement with my fact table it works:在我的事实表中使用 endofmonth dax 语句时,它可以工作:

EOM = 
CALCULATE(
    SUM('Table'[sales]),
    ENDOFMONTH('Table'[date])
)

However when I use it with my date table it returns blanks does anyone know why?但是,当我将它与我的日期表一起使用时,它会返回空白,有人知道为什么吗?

dax command using my date table:使用我的日期表的 dax 命令:

EOM_DTBLE = 
CALCULATE(
    SUM('Table'[sales]),
    ENDOFMONTH('DATE'[Date])
)

You need to check what end of month returns first:您需要首先检查月末返回的内容:

If we test it with a simple code:如果我们用一个简单的代码来测试它:

Test = CALCULATE(ENDOFMONTH('Date'[Date]))

第一

So basically, It returns the last date of each month.所以基本上,它返回每个月的最后一个日期。 If you have no data in the end of the month specified, It returns empty.如果指定的月底没有数据,则返回空。

If you have data (I have 679 on 31/01/2022) then, Code returns:如果您有数据(我在 2022 年 1 月 31 日有 679 个),则代码返回:

FDF

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM