英文:
Column indicating previous month
问题
我创建了一个筛选器,用于筛选上个月的数据,如果我在上个月,那么date_months的值等于"YES",否则值为"NO"。
然后,我想添加一个条件,如果我在每个月的第一天,也就是每个月的01号,我要考虑上个月的数据。
我尝试了以下代码,但它不起作用:
date_Month =
VAR currentrowdate =
FORMAT ( dimension_calendar[full_date], "mmyyyy" )
VAR month =
FORMAT ( NOW (), "mmyyyy" )
VAR day =
FORMAT ( NOW (), "dd" )
VAR last_month = dimension_calendar[actual_date] - 1
RETURN
IF (
day = "01",
IF ( month = last_month, "Yes", "No" ),
IF ( month = currentrowdate, "Yes", "No" )
)
你有什么建议吗?谢谢!
英文:
I created a filter that filters me on the last month, if I am in the last month the value da date_months is equal to "YES" otherwise the value is "NO".
date_Month =
VAR currentrowdate =
FORMAT ( dimension_calendar[full_date], "mmyyyy" )
VAR month =
FORMAT ( NOW (), "mmyyyy" )
VAR day =
FORMAT ( NOW (), "dd" )
VAR last_month = dimension_calendar[actual_date] - 1
RETURN
IF ( month = currentrowdate, "Yes", "No" )
then I wanted to add a condition that if I am in the first of the month that is to say the 01 of each month I take into account the previous month .
I did this, but it doesn’t work
date_Month =
VAR currentrowdate =
FORMAT ( dimension_calendar[full_date], "mmyyyy" )
VAR month =
FORMAT ( NOW (), "mmyyyy" )
VAR day =
FORMAT ( NOW (), "dd" )
VAR last_month = dimension_calendar[actual_date] - 1
RETURN
IF (
day = 01,
AND ( "No", month = last_month ),
IF ( month = currentrowdate, "Yes", "No" )
)
you will have proposals? thank you
I wanted to add a condition that if I am in the first of the month that is to say the 01 of each month I take into account the previous month .
答案1
得分: 0
尝试这个:
以前的月份 =
如果( 月份('表'[日期] -1) = 月份(今天()) - 1, "是", "否")
[![输入图像描述][1]][1]
[1]: https://i.stack.imgur.com/c636a.png
<details>
<summary>英文:</summary>
Try this one:
Previous Month =
IF( MONTH('Table'[Date] -1) = MONTH(TODAY()) - 1, "YES", "NO")
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/c636a.png
</details>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论