Forum Discussion
TOTALMTD Dax
Hello!
I am using a TOTALMTD calculation to take out monthly values. This is linked with a calender as well in order to get the correct data.
=TOTALMTD(Sum(AC[Volume]);calendar table[Date])
I was wondering if there is any way to make this show the accumulated data for all the months as well? I would prefer not be forced to make a TOTALYTD as well since I have already so many measures that the report is getting a bit slow. But whenever I select two months at the same time it just shows the figures of one month.
Thanks in advance
Oscar
Hi Anonymous ,
If you describe using measure as slicer, you can refer to this thread:https://community.powerbi.com/t5/Desktop/Measure-as-Slicer-Workaround/td-p/611781
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
7 Replies
- amitchandak
Super User
I think totalytd or datesyts would be a better idea.
Or you can try something like this
YTD Sales = var _max = maxx(allselected('Date'),'Date'[Date]) var _min = maxx(allselected('Date'),STARTOFYEAR ('Date'[Date])) return CALCULATE(SUM(Sales[Sales Amount]),filter(all('Date'),'Date'[Date]<=_max && >=_min))- AnonymousNot applicable
Thanks for your reply!
I have created all the measures with TOTALMTD and I would like it to show the YTD value as well (without creating new measures such as TOTALYTD). Is there any way to make the TOTALMTD show the YTD value? Perhaps using the date calendar as a filter on the page?
I would prefer to avoid creating new measures such as TOTALYTD as my report is getting a bit slow.
- edhans
Community Champion
You should create the new measures. Measures aren't calculated unless used, and a TotalYTD measure will be faster than any hacked TotalMTD measure to get YTD values as it would involved more filtering.
If your report is getting slow, there are other things to consider. In general, Date Intelligence measures are pretty fast if you have a good model set up and aren't doing any unusual filtering in them. i.e. multiple levels of CALCULATE, FILTER, or worse IF() statements.
- Greg_Deckler
Community Champion
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-lianl-msft
Community Support
Hi Anonymous ,
As edhans said before, you should consider creating a new measure instead of calculating YTD based on MTD.
You can refer to these articles for optimization of reporting performance and DAX performance:https://www.sqlbi.com/articles/capturing-power-bi-queries-using-dax-studio/
https://maqsoftware.com/expertise/powerbi/dax-best-practices
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.- AnonymousNot applicable
Hello,
Thank you for all the replies! I have now created a lot of measures with TOTALMTD and TOTALYTD. However, Is there any way to create a filter on the page that shows all the measures in either MTD or YTD?
Otherwise the only option is to have 2 seperate sheets in the same report, one with MTD values and one with YTD values.
Thanks a lot!
- V-lianl-msft
Community Support
Hi Anonymous ,
If you describe using measure as slicer, you can refer to this thread:https://community.powerbi.com/t5/Desktop/Measure-as-Slicer-Workaround/td-p/611781
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.