I am having a major issue trying to figure this one out. I have a table with sales data (volume, $, and dates) I also have a seperate DateKey table. What I am trying to get is if a user selects one particular month in a filter that a measure will calculate the sum of sales for that month and all proceeding sales to the start of the year.
Everything I try keeps giving me the wrong stuff so hopefully you great people will have a simple answer.
Did you ever figure this out? The YTD solution mthat people gave here, does the YTD for each month and then grows because it is like a cumulative total. What Giles and I wanted was the Actuals for each month and then if the user selects April. The April column will Have April's Data (NOT CUMULATIVE OR YTD) and in the Total Column the YTD from Jan - April.
I need help.
Have you tried using TOTALYTD
Without any sample data...
YTD Measure = TOTALYTD ( SUMX ( TableName, TableName[Volumne] * TableName[Price] ), CalendarTable[Date] )
Then if you have Year and Month slicers it should work!
If no Year is selected it will default to current year up to selected month and if no month is selected up to date!
If Year is selected and no month it will give you total for the year and if a month is also selected YTD for the selected year!
@Sean thanks for the response. I inputted the below DAX formula:
YTD test = TOTALYTD(
SUMX ( Table1, [Actual residual] ),
The measure [Actual Residual] is SUM (Table1[Dollars]) - basically it just sums the total revenue.
With your formula if I select a month the result is the same as [Actual Residual] it doesnt do a YTD total. If no months are selected your formula result is less than [Actual Residual]
@Sean - That was the first measure I tried, the issue is if I pick a month in the filter the YTD figure and the [Actual Residual] measure are the same, the TOTALYTD doesn't appear to do what it should.
One thing I have noticed is the TOTALYTD figure when no month is selected but the year is selected, the totals are different. My understanding of TOTALYTD is that it takes into account outside filters, is that correct?
@Sean, Hey did you get it working? I also have the same situation. My MTD, YTD works flawlessely. However, if I select multiple months in filter say June,July,Aug for Year 2018; my YTD shows YTD till AUG, which should show SUM of MTD b/w June till Aug only.
If I select these months on row or columns axis, my YTD shows the bifurcation correctly. However same doesnt work if I get months as filter axis.
Check out the November 2023 Power BI update to learn about new features.
130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.