Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
aashton
Helper V
Helper V

Find distinct values by group, then sum of this

Hello,

I have a database of job applicants.  To find total  applicants, if they applied multiple times in one month, it counts as one, if they apply in multiple months, count each month.  So basically, 

 CALCULATE(DISTINCTCOUNT(Table[Inquired Month]))
This works on the individual level in a table, email and this measure, how many distinct months did each person apply.  I need to find a grand total, take the total months by each email and sum this...Unsure of the syntax?
1 ACCEPTED SOLUTION

Hi @aashton 
The dax you need :

SumDistinctCounts =
SUMX(
    SUMMARIZE(
        'Emails by Month',
        'Emails by Month'[Email],
        "DistinctMonths", DISTINCTCOUNT('Emails by Month'[Month])
    ),
    [DistinctMonths]
)
Ritaf1983_0-1691764093867.png

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

9 REPLIES 9
Ritaf1983
Super User
Super User

Hi @aashton 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

I need a measure that adds up each emails distinct months, this should be 7:  (I don't see where I can attach a file)

 

aashton_0-1691761749977.png

 

Hi @aashton 

it seems :
months count = distinctcount ('your table[month])

The way to share the file :
save it in ondrive / google drive / etc... and to share a link

 

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

That only works for each email.  I need the total of all emails together, see screenshot, this adds up to 7 not 3: 

aashton_0-1691763227947.png

Sample data:  https://drive.google.com/file/d/1VyxQAzW-zapavh_AN15FYA2SLTPYeyDI/view?usp=sharing

ok, your link is not opened . 
You need to select share by link option there, not just copy a link and give it

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Hi @aashton 
The dax you need :

SumDistinctCounts =
SUMX(
    SUMMARIZE(
        'Emails by Month',
        'Emails by Month'[Email],
        "DistinctMonths", DISTINCTCOUNT('Emails by Month'[Month])
    ),
    [DistinctMonths]
)
Ritaf1983_0-1691764093867.png

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

That is great, that works!!! @Ritaf1983 I appreciate your help so  much!!!!!!

Glad to help 🙂

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

Find out what's new and trending in the Fabric Community.