Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
grajmca_sgp123
Creator
Creator

How to generate QuarterEndDate

Hi all,

I have a currency table with QuarterStartDate,Rates , different currency codes.

   

QuarterStartDateRateCurrency
3/1/20150.00636ADP
3/1/2015105.74EUR
6/1/20150.00674ADP
6/1/2015112.17EUR
9/1/20150.00679ADP
9/1/2015113.03EUR

Now My requirement is I want to assign same Rate value from QuarterStartDate to QuarterEndDate by each Currency but we do not have QuarterEndDate.How do we create QuarterEndDate in data model and how can we assign same Rate value by each Currency from .QuarterStartDate to QuarterEndDate .


this is my expected output table:For example Currency is EUR


DatesRateCurrency

All Dates From

3/1/2015 -

To

5/30/2015

Same Rate Value for all these Dates


105.74

EUR

From

6/1/2015

To

08/31/2015

Same Rate Value for all these Dates


112.17

EUR

From

9/1/2015

To

12/31/2015

113.03EUR
Same logic for other Currency codes also


Thanks in advance


6 Replies
PrashantSangle

Hi,

did you try with QuarterEnd()

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Anonymous
Not applicable

Try this one:


quarterend ( '2005-10-29' ) will return 2005-12-31

grajmca_sgp123
Creator
Creator
Author

but in table we have QuarterStartdates only....we do not have all dates to generate QuarterEnd dates.

jonathandienst
Partner - Champion III
Partner - Champion III

One way is to use the start date of the next period. Something like:

LOAD

  QuarterStartDate,

  If(Previous(Currency) = Currency,

    Date(Previous(QuarterStartDate) - 1),

    Today()) As QuarterEndDate,

  Currency,

  Rate

RESIDENT Currencies

ORDER BY Currency, QuarterStartDate DESC;

Now you can interval match the rates to the detail.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
vishsaggi
Champion III
Champion III

Hello Rejesh,

Try QuarterEnd(Date, 0,3) As QuarterEndDate.

So for eg QuarterEnd('06/01/2015', 0,3)  it Returns 08/31/2015.

Please Try and let me know.

Thanks,
V.

tamilarasu
Champion
Champion

Hi Rajesh,

Data:

LOAD * INLINE [

    QuarterStartDate, Rate, Currency

    3/1/2015, 0.00636, ADP

    3/1/2015, 105.74, EUR

    6/1/2015, 0.00674, ADP

    6/1/2015, 112.17, EUR

    9/1/2015, 0.00679, ADP

    9/1/2015, 113.03, EUR

];

Final:

Load

'From ' & QuarterStartDate & ' To ' & Monthend(AddMonths(QuarterStartDate,2)) as Dates,

Rate,

Currency

Resident Data;

Drop Table Data;

Sample attached. Let me know.