Forum Discussion
Cx2
1 year agoNew Member
Distinct count from previous month
Hey all, Pretty new to PowerBI which has been implemented in my work - and have my first issue that I can't seem to resolve via ChatGPT! Essentially I have a dataset of employees which have a...
- Anonymous1 year ago
Hi Cx2 ,
Please share sample data as well as your expected results, but you can try the following expression in general:
DistinctCountPerMonth = DISTINCTCOUNT('YourTable'[EmployeeID]) DistinctCountLastYear = CALCULATE( DISTINCTCOUNT('YourTable'[EmployeeID]), SAMEPERIODLASTYEAR('YourTable'[Date]) ) TotalDistinctCount = [DistinctCountPerMonth] + [DistinctCountLastYear]Hope it helps!
Best regards,
Community Support Team_ Scott ChangIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Uzi2019
1 year agoCommunity Champion
Hi Cx2
Current month count = CALCULATE(
DISTINCTCOUNT('Table'[ID]),DATEADD('Calendar'[Date],1,MONTH))
Prior month count= CALCULATE(
DISTINCTCOUNT('Table'[ID]),DATEADD('Calendar'[Date],-1,year))
Total count= Current month count + Prior month count
You can create seperte 3 measure or you can combine them in single measure using variable.
Total count=
Var Current month count= CALCULATE(
Var Current month count= CALCULATE(
DISTINCTCOUNT('Table'[ID]),DATEADD('Calendar'[Date],1,MONTH))
Var Prior month count= CALCULATE(
DISTINCTCOUNT('Table'[ID]),DATEADD('Calendar'[Date],-1,year))
Return Current month count + Prior month count
I hope I answered your question!