Forum Discussion
Issue with TotalYTD and Sameperiodelastyear
- 8 years ago
That solved the problem. I now get the values I want.
Thank you.
The set-up is now as follows:
Totalsalg YTD = TOTALYTD([Totalsalg];DATESYTD(Dates[Date]))
Totalsalg LYTD = CALCULATE([Totalsalg YTD];SAMEPERIODLASTYEAR('Dates'[Date]))
And I needed something to filter the year. Both a slicer that selects year or a matrix with year as rows works and gives me the YTD values. When adding a slicer that select Month of Year to-from I also get the eyar to date values from previous years.
Are those fields definitely formatted as date type fields not text?
Both Dates[date] and fact_sales_statistics[InvoiceDate] are formated as date/time. I will try to add a date field to Dates and use that in the DAX-espression.
- sokg8 years ago
Solution Supplier
you have to convert both to date (Dates[date] and fact_sales_statistics[InvoiceDate])
- misano8 years agoFrequent Visitor
I created the year columns etc as described in https://www.mssqltips.com/sqlservertip/4857/creating-a-date-dimension-table-in-power-bi/
I also changed the format of both the original date columns, Dates[date] and fact_sales_statistics[InvoiceDate] to datatype: Date
No change. Still blank values in the table.
The strange thing is that it works on a macro level using InvoiceDate as the dateparamter (even when InvoiceDate was formated as date/time). But drilling down caused gaps in the data giving me the "contiguous" error.
- sokg8 years ago
Solution Supplier
what is the min and max dates in your fact_sales_statistics[InvoiceDate] ?