Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Monthdiffernce

Hi all,

I have created two varibale vDate1,vDate2

vDate1=min(IntimationDate)

vDate2=max(Date)

I need to Find Monthdifference Between vDate1 to vDate2 and need to create bucketing like

Count(ContractNumber) where MonthDifference<4Months

Count(ContractNumber) where MonthDifference>5Months

Count(ContractNumber) where MonthDifference=4-5Months

and use that in set analysis.??

like (Count({$<"Monthdifference>4">}ContractNumber))

Kindly help Also tell how to write it in Set analysis??

1 Solution

Accepted Solutions
MarcoWedel

LOAD Month(Date2)-Month(Date1)+(Year(Date2)-Year(Date1))*12  as Monthdifference

FROM YourSource;

View solution in original post

4 Replies
Not applicable
Author

To calculate month difference:

Monthdifference = (((year(vDate2)*12)+month(vDate2)) - (((year(vDate1)*12)+month(vDate1))))

If you calculate that in LOAD script you can use it in Set Analysis afterwards the way you describe

MarcoWedel

LOAD Month(Date2)-Month(Date1)+(Year(Date2)-Year(Date1))*12  as Monthdifference

FROM YourSource;

Not applicable
Author

Hi,

Can you help me regarding how to use vMonthdifference Varible in set analysis,like

Count({$<'$(vMonthDifference)'<4>}ContractNumber) is this right??

gandalfgray
Specialist II
Specialist II

I don't think you should use a variable for your Monthdifference field, to compare against a fixed value (ie 4) try like:

Count( {<Monthdifference={"<4"}> } ContractNumber)



If you want the users to be able to change the value to compare with you can have a variable (ie vMonthDiff) and use it like:


Count( {<Monthdifference={"<$(vMonthDiff)"}> } ContractNumber)


/gg