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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
aashton
Helper V
Helper V

Help with Dax - Totals by group

I have a table set-up like:

ID  

Candidate ID

Type  (Application or Contract)

Source   (Ex. Google, web, referral)

Email

I need to count the Total Applications (distinct ID) by Source.  But, if a Candidate ID has an Application and a Contract, I will use the Source on the Contract, but if there is only an Application I will use the Source on the Application.  Unsure how to accomplish this?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @aashton ,

 

 

Here are the steps you can follow:

1. Create calculated column.

Count =
var _column=SELECTCOLUMNS(FILTER(ALL('Table'),'Table'[ID]=EARLIER('Table'[ID])),"Type1",[Type])
return
IF(
    "Application" in _column&&"Contract" in _column,
    COUNTX(
        FILTER(ALL('Table'),'Table'[ID]=EARLIER('Table'[ID])&&'Table'[Type]="Contract"),[Source]),
      COUNTX(        FILTER(ALL('Table'),'Table'[ID]=EARLIER('Table'[ID])&&'Table'[Type]=EARLIER('Table'[Type])),[Source]))

2. Result:

vyangliumsft_0-1694674160945.png

 

Best Regards,

Liu Yang

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

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi  @aashton ,

 

 

Here are the steps you can follow:

1. Create calculated column.

Count =
var _column=SELECTCOLUMNS(FILTER(ALL('Table'),'Table'[ID]=EARLIER('Table'[ID])),"Type1",[Type])
return
IF(
    "Application" in _column&&"Contract" in _column,
    COUNTX(
        FILTER(ALL('Table'),'Table'[ID]=EARLIER('Table'[ID])&&'Table'[Type]="Contract"),[Source]),
      COUNTX(        FILTER(ALL('Table'),'Table'[ID]=EARLIER('Table'[ID])&&'Table'[Type]=EARLIER('Table'[Type])),[Source]))

2. Result:

vyangliumsft_0-1694674160945.png

 

Best Regards,

Liu Yang

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

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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