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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
v-yangliu-msft
Community Support
Community Support

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
v-yangliu-msft
Community Support
Community Support

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
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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