Forum Discussion
DAX help
PY YTD Terms = CALCULATE(DISTINCTCOUNT(Terms[Employee Number]),FILTER(SAMEPERIODLASTYEAR('Date Dim'[Date]),CONTAINS(VALUES('Date Dim'[Prior Year]), 'Date Dim'[Prior Year], 'Date Dim'[Date])))
I have the above dax, which I am trying to basically just find a count of employees terminated at this point last year YTD. This formula gives me everyone for the year.. Any idea how I can adjust to get just terms YTD at the time? Thank you!
15 Replies
- mikeborg82Advocate II
I also tried using this pattern, but to not luck:
PY YTD Terms = CALCULATE(DISTINCTCOUNT(Terms[Employee Number]),(SAMEPERIODLASTYEAR(DATESYTD('Date Dim'[Date]))))
- Ashish_MathurSuper User
Hi,
How about this
=CALCULATE(DISTINCTCOUNT(Terms[Employee Number]),SAMEPERIODLASTYEAR('Date Dim'[Date]))- mikeborg82Advocate II
Oddly, this did not work. I get the same results with this calc (all of prior year), not just YTD last year at this time..
- mikeborg82Advocate II
Here is what happens. Last years terms should only be 545, and at this point last year should only be about 380.. But when i put into the table, it brings all terms. I think year is out of context, or something. just not sure how to fix. Appreciate any help. Thanks!
- mikeborg82Advocate II
PY Test = CALCULATE(DISTINCTCOUNT(Terms[Employee Number]),SAMEPERIODLASTYEAR(Terms[Actual Termination Date]))
It seems to work like this... when i refer to the date dimension table it doesnt seem to work, but this way it does. Does that seem right? could there be a reason that this is happening and maybe something i should fix upstream? Thanks, still getting my feet wet with DAX and powerbi.