Forum Discussion
TOTALYTD not working
- 9 years ago
just in case I'm not online I'll post anyways
both filters are set against the Year and MonthNameEN columns from DimDate table
SumOfSales = sum(FactEstimates[SaleNetNet])
Current Period Sales = CALCULATE([SumOfSales])
Previous Year Period Sales = CALCULATE([SumOfSales], SAMEPERIODLASTYEAR(DimDate[BK_Calendar]))
Current YTD Sales = CALCULATE([SumOfSales], DATESYTD(DimDate[BK_Calendar]))
Previous Year YTD Sales = CALCULATE([Current YTD Sales], SAMEPERIODLASTYEAR(DimDate[BK_Calendar]))
Current Full Year Sales = CALCULATE([SumOfSales], ALL(DimDate), DATESBETWEEN(DimDate[BK_Calendar], STARTOFYEAR(DimDate[BK_Calendar]), ENDOFYEAR(DimDate[BK_Calendar])))
Previous Full Year Sales = CALCULATE([Current Full Year Sales], SAMEPERIODLASTYEAR(DimDate[BK_Calendar]))
- 9 years ago
Hi David,
the previous full year is returning a total of all salesnet for 2014 as there are no dates in the date table.
there are two options I suppose, you could populate those 2014 dates in the DimDate table which would return a blank for the joined records.
or
amend the measure to manually work out the start and end dates of the previous year and only return data if these are populated.
Previous Full Year Sales =
var startdate = DATEADD(STARTOFYEAR(DimDate[BK_Calendar]), -1, YEAR)
var enddate = DATEADD(ENDOFYEAR(DimDate[BK_Calendar]), -1, YEAR)RETURN
IF(ISBLANK(startdate) || ISBLANK(enddate),blank(), CALCULATE([SumOfSales], ALL(DimDate), DATESBETWEEN(DimDate[BK_Calendar], startdate, enddate)))Dog.
Please see the attached .pbix file with 2 formulas working:
https://1drv.ms/u/s!AoP_9ampPIT7jQbxf_ttuNwBySj6
Michael
I think I know why your report is not working.
Did you use MonthNumber from for Fact? (Query1)?
If so - you need to use MonthNumber from your DimDate table in your report
Michael
- ADP0079 years agoHelper IV
Can I share my reports with you? If so how can I do this?
- Anonymous9 years agoNot applicable
Sure,
Upload them to your OneDrive and share the link
- ADP0079 years agoHelper IV
https://drive.google.com/file/d/0B2XvtNRdwqpnVEEyel9lYlpvdHM/view?usp=sharing
https://drive.google.com/file/d/0B2XvtNRdwqpnMmVGNWxIbGFJODg/view?usp=sharing
- Anonymous9 years agoNot applicable
I see that I cannot download .pbix files from external sources in my organization so I could lookat those only in the evening.
Meanwhile - did you put the MonthNumber from your DimDate table in your report?
It should work
Michael