Forum Discussion
Previous year DAX measure
- Anonymous8 years ago
resolution in case it helps someone else:
PatientsRaw = table name
Unique Patients = DISTINCTCOUNT(PatientsRaw[PersonID])
UniquePatientDiff = [Unique Patients] - CALCULATE([Unique Patients],FILTER(ALLEXCEPT(PatientsRaw,PatientsRaw[PayorName]),[CalendarYear]=MAX([CalendarYear])-1))
Hi - I'm trying to create a measure that calculates the previous year's value i.e. for 2015 the value would be 6617-6271 = 346
I"ve tried using SAMEPERIODLASTYEAR as well as PARALLELPERIOD and can't get either to work. The "year" columns is a result of the automatic date separation that PowerPivot does - it's called ServiceDate(Year) in the field list and comes from a single "ServiceDate" field. Hoping someone can help me out with this, thanks in advance!
Year Unique Patients
| 2014 | 6,271 |
| 2015 | 6,617 |
| 2016 | 6,544 |
| 2017 | 6,118 |
- Greg_Deckler8 years ago
Community Champion
PatientDiff = SUM(Patients[Unique Patients]) - CALCULATE(SUM(Patients[Unique Patients]),FILTER(ALL(Patients),[Year]=MAX([Year])-1))