• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Calculate Function shows no error but results are incorrect

Nangys

New Member
Hi All,

The issue is that this calculate formula shows no errors, but the results is incorrect:

= CALCULATE([Total Amount],fSales[Weekday]>1 || fSales[Weekday]<7)

Correct formula is:

CALCULATE([Total Amount],fSales[Weekday]>=2 && fSales[Weekday]<=6)

In fact, the incorrect formula doesn't apply any filter at all, and just brings[Total Amount].

I would like to understand what is happening and why an error messages is not display.

Regards,

Fernando
 
Hi Fernando ,

The || operator is the OR operator , which is why the condition :

fSales[Weekday]>1 || fSales[Weekday]<7

will always be satisfied , since any weekday will be greater than 1 or less than 7 ; even 1 though it does not pass the first check will pass the second check.

Thus including this condition is of no use since it will return TRUE in all cases , which is why the first formula will not apply any filter and will just return the [Total Amount].

http://www.powerpivotpro.com/2011/04/the-friendly-neighborhood-operators-and/

Narayan
 
Back
Top