Forum Discussion

asjones's avatar
asjones
Icon for Helper V rankHelper V
5 years ago

Macro or Variable For Reuseing Filters in CALCULATE

I have to create several CALCULATE() statements both off actual expense and different budget types etc.  I have several sets of filters that I need to apply in CALCULATE. I was wondering if there was a creative way to write the filters "once" and reuse them almost like a variable?  That way if they do change I only change one spot, I don't risk typos and it is just cleaner.

so calcualte mgiht look like  Calculate (<expression> , EXPENSE_TYPE)
and EXPENSE_TYPE would be replaced with something like

KEEPFILTERS (
VALUE ( 'Head Account Relations'[Head Account] ) >= 50000
&& VALUE ( 'Head Account Relations'[Head Account] ) <= 79999
&& VALUE ( 'Head Account Relations'[Head Account] ) <> 56950
),
KEEPFILTERS (
VALUE ( 'Financial Actuals Table'[Account] ) <> 96910
&& VALUE ( 'Financial Actuals Table'[Account] ) <> 96950
) ,
KEEPFILTERS( VALUE('Main Project Master File - PMF'[PMF Project Type] ) >= 30 &&
VALUE( 'Main Project Master File - PMF'[PMF Project Type] ) <= 69
)

 

Any ideas or thoughts?

 

I would think this is something others wold want.

 

thanks

 

Alan

 

 

4 Replies