Forum Discussion
How I accumulate clients different months
- 5 years ago
Ok. With this model:
And these measures:
Number of attentions = COUNT(FactTable[CUSTOMER])Distinct Customers = DISTINCTCOUNT(FactTable[CUSTOMER])and..
New customers = CALCULATE ( DISTINCTCOUNT ( FactTable[CUSTOMER] ), FILTER ( ALL ( 'Date Table' ), 'Date Table'[Date] <= MAX ( 'Date Table'[Date] ) ) )You get the following:
- 5 years ago
This should work:
New customers = VAR _Year = SELECTEDVALUE ( Date Table [Year] ) CALCULATE ( DISTINCTCOUNT ( FactTable[CUSTOMER] ), FILTER ( ALL ( 'Date Table' ), 'Date Table'[Date] <= MAX ( 'Date Table'[Date] ) && Date Table [Year] = _Year ) )
Sorry, could you please explain the relevance of the rows where Date = "21 years ago"?
Also, do the date values such as 21-feb or 21-july refer to year-month or date-month?
what do the rows for Date = June 21-2 actually mean? (does your real data actually look like this??)
It would be very helpful is you provided a sample PBIX file via Dropbox, OneDrive, Google Drive...
Sorry, the table was copied wrong when pasting it, the date field is in date format (DD/MM/YYYY) but pasting it here changes the format.
| DATE | CUSTOMER |
| January/2021 | KAREN |
| January/2021 | KAREN |
| January/2021 | PAOLA |
| January/2021 | VAIN |
| February/2021 | PAOLA |
| February/2021 | ANDREINA (NOWA) |
| February/2021 | VAIN |
| February/2021 | GABRIELA |
| March/2021 | KARINA |
| March/2021 | PAOLA |
| March/2021 | ANDREINA (NOWA) |
| March/2021 | KAREN |
| March/2021 | ANGELA |
| April/2021 | CARLA |
| April/2021 | YENNY |
| April/2021 | ADELAIDE |
| April/2021 | PAOLA |
| May/2021 | SOFIA |
| May/2021 | GIULIANNA |
| May/2021 | ANDREINA (NOWA) |
| June/2021 | PAOLA |
| June/2021 | ANGELA |
| June/2021 | ROSE |
| July/2021 | CYNTHIA |
| July/2021 | CYNTHIA |
| July/2021 | PAULA |
| July/2021 | PRISCILLA |
| August/2021 | KAREN |
| August/2021 | ANGELA |
| August/2021 | ANGELA |
| August/2021 | PAULETTE |
| UNIQUE PATIENTS | 17 |
- PaulDBrown5 years ago
Community Champion
Ok. With this model:
And these measures:
Number of attentions = COUNT(FactTable[CUSTOMER])Distinct Customers = DISTINCTCOUNT(FactTable[CUSTOMER])and..
New customers = CALCULATE ( DISTINCTCOUNT ( FactTable[CUSTOMER] ), FILTER ( ALL ( 'Date Table' ), 'Date Table'[Date] <= MAX ( 'Date Table'[Date] ) ) )You get the following:
- Syndicate_Admin5 years ago
Administrator
Thank you very much, there is only something that does not come out, it does not restart in each year, it accumulates for all the years that there is customer service.
What would be the modification so that the beginning of each year is restarted?
Thanks a lot- PaulDBrown5 years ago
Community Champion
This should work:
New customers = VAR _Year = SELECTEDVALUE ( Date Table [Year] ) CALCULATE ( DISTINCTCOUNT ( FactTable[CUSTOMER] ), FILTER ( ALL ( 'Date Table' ), 'Date Table'[Date] <= MAX ( 'Date Table'[Date] ) && Date Table [Year] = _Year ) )