Forum Discussion
CM vs PM
I need to know how to go from a Power BI data table like shown below to be able to create a Power BI visual as shown below under Results (CM vs PM). There would be a filter by date so in this instance the dashboard would be filtered by Jan-2020.
Anonymous are you getting any error or not getting any result. What is the issue? Can you share relationship diagram and the measure you used for PM
You can also use datesmtd or totalmtd with date calendar
Example
MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date])) last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH))) last MTD (complete) Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-1,MONTH)))) last year MTD (complete) Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-12,MONTH))))To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s.
Refer
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Connect on Linkedin
5 Replies
- amitchandakSuper User
You can also use datesmtd or totalmtd with date calendar
Example
MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date])) last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH))) last MTD (complete) Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-1,MONTH)))) last year MTD (complete) Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-12,MONTH))))To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s.
Refer
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Connect on Linkedin - parry2kSuper User
Anonymous add calendar dimension in your model, there are many blog posts on how to add one and then use previousmonth or other time intelligence DAX function to get PM.
- AnonymousNot applicable
I have a calendar table (from Avi Singh) in the dashboard that is tied to the data table. I have tried previousmonth various different ways and nothing has worked.
- parry2kSuper User
Anonymous are you getting any error or not getting any result. What is the issue? Can you share relationship diagram and the measure you used for PM
- v-juanli-msftCommunity Support
Hi Anonymous
As tested, amitchandak's formula works.
pm = CALCULATE(SUM('Table'[Packages]),DATESMTD('calendar'[Date])) cm = CALCULATE(SUM('Table'[Packages]),DATESMTD(DATEADD('calendar'[Date],-1,MONTH)))Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.