Forum Discussion
Multiple dates with mtd and ytd
Hi Folks, I have one fact table, Date table and fact table contains multiple dates so i want to build MTD and YTD calucaltions on top of multiple dates column so how can i achieve into power bi.
2 Replies
- amitchandak
Super User
Anonymous , You need to join all the dates with the Date table. The only one will active(from one table). Inactive join you can activate using use relationship
Assume created date has an inactive join then try like
calculate( calculate( SUM(Sales[Sales Amount]),USERELATIONSHIP ('Table'2[CreateDate], 'Date'[Date])),DATESMTD('Date'[Date]))
//YTD
calculate( calculate( SUM(Sales[Sales Amount]),USERELATIONSHIP ('Table'2[CreateDate], 'Date'[Date])),DATESYTD('Date'[Date]))
also refer:
Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA
Power BI — Qtr on Qtr with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-qtd-questions-time-intelligence-2-5-d842063da839
https://www.youtube.com/watch?v=8-TlVx7P0A0
Power BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA - v-janeyg-msft
Community Support
Hi, Anonymous
Is your problem been solved?
You can use userelationship function to connect the inactive join like amit said.
Reference:
USERELATIONSHIP function (DAX) - DAX | Microsoft Docs
DATESYTD function (DAX) - DAX | Microsoft Docs
TOTALMTD function (DAX) - DAX | Microsoft Docs
If it doesn’t solve your problem, please share some sample fake data and your desired result, and feel free to ask me.
Best Regards
Janey Guo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.