Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
robmarr789
Contributor
Contributor

where to put parenthesis

Can anyone help me with where to put the parenthesis in this expression. Can't for the life of me figure out where I'm going wrong.

=SUM(IF(Year(DocumentDate) = YEAR(Today())-1 and month(DocumentDate) < month(Today()) or Year(DocumentDate) = YEAR(Today())-1 and (month(DocumentDate) = month(Today())

and (day(DocumentDate) =< day(Today()),1,0))

5 Replies
ychaitanya
Creator III
Creator III

try This

=SUM(

IF(

(Year(DocumentDate) = YEAR(Today())-1 and month(DocumentDate) < month(Today()) )

or

(Year(DocumentDate) = YEAR(Today())-1 and month(DocumentDate) = month(Today()) )

and

day(DocumentDate) <= day(Today())

,1,0)

)

shiveshsingh
Master
Master

Can you tell on what condition you need 1 and on what 0?

chinnuchinni
Creator III
Creator III

try with this.....

=sum(

if (

year(DocumentDate)=year(today())-1 and month(Documentdate) < month(today())  or

(year(DocumentDate) =year(today()) -1 and month(DocumentDate) = Mlonth(today()) and day(documentDate)  <= day(today())),

1, 0

)

)

pradosh_thakur
Master II
Master II

Is this what you want ? looks much simpler with this

=SUM(IF(Year(DocumentDate) = YEAR(Today())-1 and month(DocumentDate) <= month(Today())

and day(DocumentDate) =< day(Today()),1,0))

Learning never stops.
Anonymous
Not applicable

Hi Robert,


Placing parenthesis will depends up on expected output.


Can you explain briefly, while using this condition what is the expected output ?


Kindly post a sample workbook. It will helps to all to understand your requirement clearly.


Thanks,

Venkata Sreekanth