DAX formula for count if?

blownbyyou

New Member
Joined
Mar 29, 2017
Messages
6
So I am new to powerpivot and the DAX functionality, for the most part I have been able to google my way out of trouble. But unfortunately on this one I am completely stuck and was hoping to get some help. I am trying to do a simple countif but for some reason my forumulas keep coming back wrong or with errors...

The file is a list of all items booked in my company by day, I am trying to simply count the amount of occurrences that one item # has been on the list. Below is a simple idea of what I am trying to do...


Product #Count
D1125a5
D1125a5
D1125a5
D1125a5
D1125a5
D11372
D11372
D11381

<colgroup><col><col></colgroup><tbody>
</tbody>

I tried to do the formula =CALCULATE(COUNTROWS('Source Data'),FILTER('Source Data','Source Data'[Product Number]=EARLIER('Source Data'[Product Number]))) but that came back as an error so I figured it was an issue with my earlier statement so I tried this...


=CALCULATE(COUNTROWS('Source Data'),FILTER('Source Data','Source Data'[Product Number]="d1125a")) and it came backe with value of 1 regardless of how many times that item # was listed...

What am I doing wrong?

Thanks for the help..
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
This works for me for new column:

Code:
=CALCULATE(COUNTROWS(Source_Data);FILTER(Source_Data;Source_Data[Product #]=EARLIER(Source_Data[Product #])))

Remark: ; = ,
 
Upvote 0
Add new column number row (NoRows) and create Pivot Table like on the picture:

7WdsNsGaockm9wXhDyVGXGe_TMJByUp7_FBev4E7EdA

[/IMG]
 
Upvote 0

Forum statistics

Threads
1,214,430
Messages
6,119,438
Members
448,897
Latest member
dukenia71

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