Hi,
i've found this post through an internet search. I also pretend to do a Prior MTD calculation on distinct customers and i've tried many versions without success.
My situation is this: i have a fact table 'fct sales' that connects to a time dimension 'dim posting date' through an int 'sk_posting_date', and the time dimension has a date value in 'date' attribute, which, from what i've been reading, is
a bad idea, i read that it this relation should be done through a date 'sk_posting_date'. I'd like to know if this is mandatory or recommend, to easy dax calculations related to time.
the time dimension is continuous.
i've tried this in model.bim and immediatly had results in model.bim.
Nr Distinct Customers Month -1:=CALCULATE(DISTINCTCOUNT([SK_CUSTOMER]); DATEADD('Dim Posting Date'[Date];-1;MONTH)) result is 4427, equal to the actual MTD
Nr Distinct Customers Month -1 v2 Marco:=CALCULATE(DISTINCTCOUNT('Fct Sales'[SK_CUSTOMER]);DATESINPERIOD('Dim Posting Date'[Date];MAX('Dim Posting Date'[Date]); -1; MONTH )) result is blank
Nr Distinct Customers Month -1 vt5:=CALCULATE(DISTINCTCOUNT([SK_CUSTOMER]); PARALLELPERIOD('Dim Posting Date'[Date];-1;MONTH)) result is also 4427
Nr Distinct Customers Month -1 vt7:=CALCULATE(DISTINCTCOUNT([SK_CUSTOMER]); DATESBETWEEN('Dim Posting Date'[Date];FIRSTDATE('Dim Posting Date'[Date]);LASTDATE('Dim Posting Date'[Date]))) also 4427
Nr Distinct Customers Month -1 vt8:=CALCULATE(DISTINCTCOUNT([SK_CUSTOMER]);
DATESBETWEEN('Dim Posting Date'[Date];
FIRSTDATE(DATEADD('Dim Posting Date'[Date];-1;MONTH));
LASTDATE(DATEADD('Dim Posting Date'[Date];-1;MONTH))
)) also 4427
Nr Distinct Customers Month -1 v3:=CALCULATE(DISTINCTCOUNT('Fct Sales'[SK_CUSTOMER]);PARALLELPERIOD('Dim Posting Date'[Date];-1;MONTH);ALL('Dim Posting Date')) also 4427
So, i'd like to know what am i doing wrong, and if must create a date column on my 'fact sales' to easy the calculations.
Kind regards
-
Edited by
Lrmmf_
Thursday, June 04, 2015 11:45 PM