Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi All,
Can you please help me write dynamic DAX measure? I have the date and Email address column in a table. I want to find how many emails were sent during a given period and categorize them accordingly. I am using a date in a filter and by changing the date, I can change the category ( i.e. number of emails sent) in that given period.
For instance, in Jan-2020 two email was sent and it will be categorized as 2 emails. And when I change the filter from month to year it gives me an email sent in a year to the customer.
Thank you so much for any given any help!
| Date | EmailAddress | Email Sent/Year |
| 10-Jan-20 | A@com | 4 |
| 20-Jan-20 | A@com | 4 |
| 21-Jul-20 | A@Com | 4 |
| 21-Mar-20 | A@com | 4 |
| 22-Mar-21 | A@com | 3 |
| 2-Apr-21 | A@com | 3 |
| 3-Apr-21 | A@com | 3 |
Solved! Go to Solution.
@Anonymous Maybe:
Email Sent/Year =
VAR __Year = YEAR(MAX('Table'[Date]))
VAR __EmailAddress = MAX('Table'[EmailAddress])
VAR __Table = FILTER(ALL('Table'),YEAR('Table'[Date])=__Year && 'Table'[EmailAddress]=__EmailAddress)
RETURN
COUNTROWS(__Table)
Hi @Anonymous
The DAX measure doesn't need to be complicated for this:
Emails Sent = COUNTROWS(Table)
You can then construct a visual (eg matrix of email vs year) or combination of visuals (eg date slicer and table with email & Emails Sent) to get the insight.
@Anonymous Maybe:
Email Sent/Year =
VAR __Year = YEAR(MAX('Table'[Date]))
VAR __EmailAddress = MAX('Table'[EmailAddress])
VAR __Table = FILTER(ALL('Table'),YEAR('Table'[Date])=__Year && 'Table'[EmailAddress]=__EmailAddress)
RETURN
COUNTROWS(__Table)
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 6 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 25 | |
| 16 | |
| 7 | |
| 7 | |
| 7 |