# Qlik DataMarket Discussions

Discussion Board for collaboration regarding Qlik DataMarket.

Highlighted
New Contributor III

## How to find the months b/w Transaction Started Date and target achieved

Hi

I have some customers who started their transaction in different months and achieved their targets in difference months. i need the count of the months between transaction date and target achieved date for individual customers. For e.g (customer A started transaction on march and achieved on December. but customer B started transaction on June and achieved on November.

So i need to get Customer A  =December-March (12-3)=9 months

Customer A  =November-June(11-6)= 5 months

Can anyone help for this???

1 Solution

Accepted Solutions
Not applicable

## Re: How to find the months b/w Transaction Started Date and target achieved

Hi Kumaran

Please share your model, its difficult to provide a solution without seeing an example

3 Replies
Not applicable

## Re: How to find the months b/w Transaction Started Date and target achieved

Hi Kumaran

Please share your model, its difficult to provide a solution without seeing an example

MVP & Luminary

## Re: How to find the months b/w Transaction Started Date and target achieved

Try Year([target achieved])*12 + Month([target achieved]) - Year([Transaction Started Date])*12 - Month([Transaction Started Date])

If you need something more accurate use this: Num years in decimal

talk is cheap, supply exceeds demand
Not applicable

## Re: How to find the months b/w Transaction Started Date and target achieved

You can maybe try to use the Aggr() and FirstSortedValue() functions together

You should first get the 2 dates per Customer in order to do the date comparison.

To get the first Transaction date - Aggr(FirstSortedValue('Transaction date', 'Transaction date'), 'Customer Field')

To get the first Target Acheived date - Aggr(FirstSortedValue('target achieved date', 'target achieved date'), 'Customer Field')

You can then subtract those 2 values from each other to get the difference