PowerPivot Unique CountIfs

eliwaite

New Member
Joined
Feb 24, 2015
Messages
30
I have two tables, similar to below:

Roster:
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Region[/TD]
[TD]Name[/TD]
[/TR]
[TR]
[TD]AMS[/TD]
[TD]Jon[/TD]
[/TR]
[TR]
[TD]AMS[/TD]
[TD]Nancy[/TD]
[/TR]
[TR]
[TD]AMS[/TD]
[TD]Adam[/TD]
[/TR]
</tbody>[/TABLE]

Sales:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Region[/TD]
[TD]Name[/TD]
[TD]Sales Amount[/TD]
[TD]Has Sale[/TD]
[/TR]
[TR]
[TD]AMS[/TD]
[TD]Jon[/TD]
[TD]$100[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]AMS[/TD]
[TD]Nancy[/TD]
[TD]$200[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]AMS[/TD]
[TD]Nancy[/TD]
[TD]$50[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]AMS[/TD]
[TD]Jon[/TD]
[TD]$100[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]AMS[/TD]
[TD]Jon[/TD]
[TD]$150[/TD]
[TD]1[/TD]
[/TR]
</tbody>[/TABLE]

The two tables are connected by the Name column. I am trying to determine what percentage of sales reps have sold something. I would like the output table to look like:

[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Region/Name[/TD]
[TD]% with Sales[/TD]
[/TR]
[TR]
[TD]AMS[/TD]
[TD]66%[/TD]
[/TR]
[TR]
[TD] Jon[/TD]
[TD]100%[/TD]
[/TR]
[TR]
[TD] Nancy[/TD]
[TD]100%[/TD]
[/TR]
[TR]
[TD] Adam[/TD]
[TD]0%[/TD]
[/TR]
</tbody>[/TABLE]

The basic formula is "Has Sale"/"Count of Names"

I got the "Count of Names", what I need help with is how to get an accurate "Has Sale".

I have tried: Calculate(countrows('Sales'),'Sales'[Has Sale]=1), but this returns 2 for Nancy, 3 for Jon and 5 for AMS. What I need is a formula that will return 1 for Nancy, 1 for Jon and 2 for AMS. I am assuming there is probably a straightforward solution for this, but being new to PowerPivot and DAX formulas I am at a loss. Any advice would be greatly appreciated.
 
Last edited:

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Try this: CALCULATE(AVERAGE([Has Sale])*DISTINCTCOUNT([Name]);Sales[Has Sale]=1)

hth, Imke
 
Upvote 0
Thanks for the advice. I ended up going with: DIVIDE(CALCULATE(DISTINCTCOUNT(Roster[Name]),FILTER('Sales','Sales'[Has Sale]>0)),[Count of Employees]) I had to use the >0 because my real table has sales for different products, and I only wanted the results for a specific product.
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,314
Members
452,634
Latest member
cpostell

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top