# New to QlikView

Discussion board where members can get started with QlikView.

Contributor

## comparing month year between two dates

hi

I have two dates

date1          date2

4/24/2016    5/14/2017

3/30/2017    6/17/2015

.

.

i want to compare  month year of date1 =  month year of date 2

and quarter year of date 1 = quarter year of date 2

Qliksss suggest

Tags (1)
1 Solution

Accepted Solutions
Esteemed Contributor II

## Re: comparing month year between two dates

use

if(QuarterName(Date1) = QuarterName(Date2) , Quantity , 0)

10 Replies
Contributor II

## Re: comparing month year between two dates

Hi,

Can you please elaborate with example what u want.

Regards

Contributor

## Re: comparing month year between two dates

There are two date fields

i just want to compare month year of one date to month year of another date

if(4/2016=5/2017, 1,0)

MVP

## Re: comparing month year between two dates

May be like this?

InMonth(Date1, Date2, 0)

InQuarter(Date1, Date2,0)

Contributor III

## Re: comparing month year between two dates

Extract month and year for both fields

Month(date1)

Year(date1)

Month(date2)

Year(date2)

Now you can compare these derieved fields

incase you need month year then concatenate both fields

Date#(Month(date1)&', '&Year(date1) ,'MMM, YYYY') as Month_Year1

Date#(Month(date2)&', '&Year(date2),'MMM, YYYY') as Month_Year2

Contributor

## Re: comparing month year between two dates

But i want to give expression if equals quantity  not true or false

Contributor

## Re: comparing month year between two dates

i know this way but i want simple way

as i need to write other expressions based on that

MVP

## Re: comparing month year between two dates

InMonth()/InQuarter() themselves return true or false. You can try like:  =If( InMonth(Date1,Date2,0), 'true', 'false')

Contributor III

## Re: comparing month year between two dates

what do you want to do exactly ?

Contributor

## Re: comparing month year between two dates

if(quarter year date1=quarter year date 2,quantity,0)

is there any pre defined function??????