Quantcast
Channel: Excel IT Pro Discussions forum
Viewing all articles
Browse latest Browse all 11829

Using OR type function with Calculate and Filter

$
0
0

I am using the Calculate function to count rows in a related table with filters applied.  Where I'm stuggling is that I want to apply a filter with 2 different conditions on the same column. I think Power pivot is treating it as an "AND" and I need it as an "OR"

I need to determine which employees are still employed OR left this year. So, I need 2 similar expressions: Last Date is not blank OR Last Date>=1/1/2014.

this (below) works to show only those with a blank last date (still employed), but I need the people that left this year.

=Calculate(Countrows('Employees'[Name]), filter('Employees',isblank('employees'[Last Date])) 

If I add an OR statement like below PowerPivot errors.

=Calculate(Countrows('Employees'[Name]), OR(filter('Employees',isblank('employees'[Last Date]),filter('Employees','Employees'[Last Date]>=1/1/2014)))

This below also doesn't work--returns blank value because (I think) no employee is going to have a Last Date in 2014 AND a blank Last Date.  So how do I get powerpivot to treat the 2 expressions as an "OR"?

=Calculate(Countrows('Employees'[Name]), filter('Employees',isblank('employees'[Last Date]),filter('Employees','Employees'[Last Date]>=1/1/2014))


Viewing all articles
Browse latest Browse all 11829

Trending Articles