Forum Discussion
Recalculate occurrence base on year
Hi,
I currently have the occurrence calculation of my customers from the entire time frame (2019 -2020)
However I what I want to achieve is to calculate the occurrences base on different years, meaning recalculate the occurrence from the beginning of next year:
| Date | customerID | Occurrence |
| 1-1-2019 | 123 | 1 |
| 1-2-2019 | 123 | 2 |
| 1-3-2020 | 123 | 1 |
| 1-4-2021 | 123 | 1 |
Add filter in the formula
&& 'unique order customer'[Year] = earlier( 'unique order customer'[Year])
4 Replies
- amitchandak
Super User
Add filter in the formula
&& 'unique order customer'[Year] = earlier( 'unique order customer'[Year])
- dgdgdg122db
Helper II
Hi amitchandak could you please tell me where I should add the second filter specifically, I have tried and I kept getting errors, thank you
- amitchandak
Super User
in the filter where [unique customer no.] end give space and add a filter for the year.
else please give your formula in text format
- v-kelly-msft
Community Support
Hi dgdgdg122db ,
Use a dax expression as below:
Customer occurrence=countx(filter('Unique Order customer','Unique Order customer'[Customer No.]=EARLIER('Unique Order customer'[Customer No.]&&'Unique Order customer'[Year]=EARLIER('Unique Order customer'[Year]),'Unique Order customer'[Customer No.])Best Regards,
KellyDid I answer your question? Mark my post as a solution!