# QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
New Contributor II

## How to calculate MonthStart to Today + LYMonthToday to MonthEnd?

For this calculation, I need the data from the current month's first day to current day, plus the data from last year of the same month and day until the end of the month. It cannot be static, meaning when the current date changes, so must the aggregation of the data sets.

For example, (December 1, 2017 - December 13, 2017) + (December 13, 2016 - December 31, 2016)

And in a week (December 1, 2017 - December 20, 2017) + (December 20, 2016 + December 31, 2016)

I currently have two variables to represent the two sets of criteria

vTRIRCurrentMonth: '>=\$(monthstart(dte))<=\$(vToday())'

vTRIRMonthLY: '>=\$(vPreviousYearMonth=Today())<=\$(vPreviousYearMonth=MonthEnd)'

I am not getting results when I combine in the expression for the chart.

Tags (3) MVP

## Re: How to calculate MonthStart to Today + LYMonthToday to MonthEnd?

May be this?

And For Month

Sum({<DateFields= {">=\$(=Date(MonthStart(Today()))) <=\$(=Date(WeekEnd(Today())))"}>} Sales) + Sum({<DateFields= {">=\$(=Date(AddYears(Today(),-1))) <=\$(=Date(AddYears(MonthEnd(Today()),-1)))"}>} Sales)

And For week

Sum({<DateFields= {">=\$(=Date(MonthStart(Today()))) <=\$(=Date(Today()))"}>} Sales) + Sum({<DateFields= {">=\$(=Date(AddYears(WeekEnd(Today()),-1))) <=\$(=Date(AddYears(MonthEnd(Today()),-1)))"}>} Sales)

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)