Forum Discussion
Problem with DATESMTD
- Anonymous9 years ago
Your english is great!
*if* you calendar stopped at the end of May... this would work fine.
Ignoring that, you can add a calc column on your calendar table:
IsCurrentMonth = IF (MONTH(TODAY()) = MONTH(MyCalendar[Date]), TRUE(), FALSE())
Then set a filter on the card visual to IsCurrentMonth = TRUE ?
What is in the Fecha column? It needs to be a date type for it to work
Hi Matt, thanks for your answer.
Fecha is Date, and it has Date format, is the primary key of the Calendar Table. I have used other time inteligence fuctions such as PREVIOUSMONTH() without any problem.
Here you can see the Calendar table:
Thanks.
- Anonymous9 years agoNot applicable
My best guess is that in your fact table, you have dates WITH time -- which won't match up w/ your calendar table, which doesn't have times. If that is the case, you need to strip off the times in the fact table.
- ContabilidadBI9 years agoHelper III
Hi Scottsen, thanks for your reply.
In the sales table, the date is just a date without time.
I have been thinking that maybe there is something else I need to put in the formula that will indicate that I want the sum of sales for the current month (May), something like today(), month()....
Because I keep getting blank as output and I do have sales in May in the sales table, the output should be something like 10k.
This is driving me nuts!
Thanks for the help.
- Anonymous9 years agoNot applicable
Ooohh!
MTD doesn't respect the current date at all. It's relative to the current filter context. If you go create a table w/ every day on it... you will see your measure working... growing the value each day, until end of month... when it resets to 1st day of month again.
You would need to do some sort of FILTER(ALL(Calendar), Calendar[Date] > TODAY() - DAY(TODAY()) + 1)
or probably easier to add a calc column to your calendar table IsCurrentMonth and use that to filter.