Forum Discussion
MTD for current year only
Can someone help me with calculating MTD for current year only
Thanks Jamie
Anonymous As a best practice, add date dimension in your model and use it for and time intelligence calculations. Once the date dimension is added, mark it as a date table on table tools.
https://perytus.com/2020/05/22/create-a-basic-date-table-in-your-data-model-for-time-intelligence-calculations/Now you can add a measure for MTD
MTD Sales = CALCULATE ( SUM ( Table[Sales] ), DATEMTD ( Calendar[Date] ) )I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.⚡
Hi Anonymous ,
You may create a calendar table first of all, then create relationship with your fact table on the date field.
Calendar= CALEANDARAUTO()
Then you may create measure like DAX below.
MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Calendar'[Date]))
Best Regards,
Amy
Community Support Team _ Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 Replies
- parry2kSuper User
Anonymous As a best practice, add date dimension in your model and use it for and time intelligence calculations. Once the date dimension is added, mark it as a date table on table tools.
https://perytus.com/2020/05/22/create-a-basic-date-table-in-your-data-model-for-time-intelligence-calculations/Now you can add a measure for MTD
MTD Sales = CALCULATE ( SUM ( Table[Sales] ), DATEMTD ( Calendar[Date] ) )I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.⚡
- Greg_DecklerCommunity Champion
Anonymous - See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TITHW/m-p/434008 - v-xicaiCommunity Support
Hi Anonymous ,
You may create a calendar table first of all, then create relationship with your fact table on the date field.
Calendar= CALEANDARAUTO()
Then you may create measure like DAX below.
MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Calendar'[Date]))
Best Regards,
Amy
Community Support Team _ Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.