Trouble passing a user-specified input variable to CALCULATE function

scooper43

New Member
Joined
May 25, 2012
Messages
7
In order to get user-specified input into the data model, I created a linked table where the user can define a text string for a series of application monitors as per below:


Excel 2010
BC
2Application MonitorsApp To Monitor
3Application Monitor #1Blackberry
4Application Monitor #2Skype
5Application Monitor #3
6Application Monitor #4
7Application Monitor #5
8Application Monitor #6
9Application Monitor #7
10Application Monitor #8
11Application Monitor #9
12Application Monitor #10
13Application Monitor #11
14Application Monitor #12
Inputs


Now I want to filter based on the protocol that the user specified:

I have tried:

CALCULATE (SUM (xxx), LOOKUP (Inputs[App To Monitor], Inputs [Application Monitor] = "Application Monitor #1"))

but it doesn't let me put a LOOKUP function inside a CALCULATE function. The Inputs table is not related to anything -- just a way for me to store these "global variables"

Is there a better way to do this?

I also tried the ROW function

i.e.
CALCULATE (SUM (xxx), ROW (Inputs[Application Monitor], 1))

But it gives me a funny error on the ROW command - first arguement needs to be a column -- it is !!

Thanks in advance for your help

Steve
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
CALCULATE generally does not allow complex expressions in its comparisons.

Instead of CALCULATE(xxx, filter expr) try CALCULATE(xxx, FILTER(table, filter expr))

But only use FILTER when you have to. It generally results in slower formulas than CALCULATE so only use it when normal CALCULATE won't do the trick.
 
Upvote 0

Forum statistics

Threads
1,215,076
Messages
6,122,988
Members
449,093
Latest member
Mr Hughes

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