Forum Discussion
Sameperiodlastyear funcion issue
Hi.
First of all, do you have a proper date table in your model that is designated as such and covers all FULL years for your date columns in any of your tables? If you don't, then time-BI functions will not work correctly. To me it looks like you're using time-BI functions without a proper date table. Might be wrong, of course.
Best
Darek
- Adidas7 years ago
Helper I
Hi Darek
I do have a time dimension table generated by this Dax code:
Date = VAR BASECALENDAR = CALENDAR ( DATE ( 2009, 01, 01 ), TODAY () ) RETURN GENERATE ( BASECALENDAR, VAR BASEDATE = [DATE] VAR YEARDATE = YEAR ( BASEDATE ) VAR MONTHNUMBER = MONTH ( BASEDATE ) VAR MONTHNAME = FORMAT ( BASEDATE, "MMMM" ) VAR YEARMONTHNAME = FORMAT ( BASEDATE, "MMM-YY" ) VAR YEARMONTHNUMBER = ( YEARDATE * 12 + MONTHNUMBER ) - 1 RETURN ROW ( "DAY", BASEDATE, "YEAR", YEARDATE, "MONTH NUMBER", MONTHNUMBER, "MONTH", MONTHNAME, "YEAR MONTH NUMBER", YEARMONTHNUMBER, "YEAR MONTH", YEARMONTHNAME ) )the sales fact table is linked to this dimension by inv date = dim date
- Anonymous7 years agoNot applicable
Why would you have cross-filter enabled on the relationship? What's the use of it? You should switch to one-way filtering from dim to the fact table and then see what happens.
- Adidas7 years ago
Helper I
Hi
I've built a demo model to isolate the problem,
it's one to one relationship so I'm forced to set both ways join
however, it has nothing to do with my issue since in the original model it's one-way join and still the same wrong calculation.
I'm starting to believe that Sameperiodlastyear function is context related and was design to work like this