calculate - countrows - IN Question

gmazza76

Well-known Member
Joined
Mar 19, 2011
Messages
769
Office Version
  1. 365
Platform
  1. Windows
Good afternoon,

I have a column in my "SourceDataTable" that is called "Success" that holds outcomes of data and I need to be able to add these all up based on the outcome in "Success"
In the example below I am filtering by "Area", "Brand" & "Date" as per below, but I need the Calculation to add up the words "Direct", "1 question" etc..
The Works formula below works but I have 2 sections underlined and I am unsure why as I haven't used "IN" before, but when I nest the "Syntax Error" one it fails but I am unsure what I have missed.

Any help greatly appreciated

Code:
Works
=if(SourceDataTable[Outcome]="Success",CALCULATE(COUNTROWS(SourceDataTable),
FILTER(SourceDataTable,SourceDataTable[Area]=SourceDataTable[Area]),FILTER(SourceDataTable,SourceDataTable[Brand]=SourceDataTable[Brand]),
FILTER(SourceDataTable,SourceDataTable[Week No]=WEEKNUM(today(),21)-1),
SourceDataTable[Success] in {"direct","1 Questions","2 Questions","3 Questions","4 Questions","5 Questions"}),blank()

Syntax Error
=if(SourceDataTable[Outcome]="Success",CALCULATE(COUNTROWS(SourceDataTable),
FILTER(SourceDataTable,SourceDataTable[Area]=SourceDataTable[Area]),FILTER(SourceDataTable,SourceDataTable[Brand]=SourceDataTable[Brand]),
FILTER(SourceDataTable,SourceDataTable[Week No]=WEEKNUM(today(),21)-1),
SourceDataTable[Success] IN {"Direct","1 Questions","2 Questions","3 Questions","4 Questions","5 Questions"}),
if(SourceDataTable[Outcome]="Fail",CALCULATE(COUNTROWS(SourceDataTable),
FILTER(SourceDataTable,SourceDataTable[Area]=SourceDataTable[Area]),FILTER(SourceDataTable,SourceDataTable[Brand]=SourceDataTable[Brand]),
FILTER(SourceDataTable,SourceDataTable[Week No]=WEEKNUM(today(),21)-1),
SourceDataTable[Success] IN {"Direct","A1","A2","A3","A4","A5"}),
BLANK())

thanks in advance
Gavin
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,223,702
Messages
6,173,966
Members
452,539
Latest member
delvey

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