Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
nareshthavidishetty
Creator III
Creator III

Year start

Hi,

I'm using the below logic as expression but it showing results starts from Jan.

But i need to show them FEB.

The year starts from Feb .

Logic:

=Sum({<SoldDate = {

"$(='>=' & Date(YearStart(Max(SoldDate), 0), 'M/D/YYYY') & '<=' & Date(AddYears(Max(SoldDate), 0), 'M/D/YYYY'))",

"$(='>=' & Date(YearStart(Max(SoldDate), -1), 'M/D/YYYY') & '<=' & Date(AddYears(Max(SoldDate), -1), 'M/D/YYYY'))",

"$(='>=' & Date(YearStart(Max(SoldDate), -2), 'M/D/YYYY') & '<=' & Date(AddYears(Max(SoldDate), -2), 'M/D/YYYY'))",

"$(='>=' & Date(YearStart(Max(SoldDate), -3), 'M/D/YYYY') & '<=' & Date(AddYears(Max(SoldDate), -3), 'M/D/YYYY'))"

}, SoldMonth, SoldYear>}ESTCUST)



Thanks..

1 Solution

Accepted Solutions
sunny_talwar

Try this

=Sum({<SoldDate = {

"$(='>=' & Date(YearStart(Max(SoldDate), 0, 2), 'M/D/YYYY') & '<=' & Date(AddYears(Max(SoldDate), 0), 'M/D/YYYY'))",

"$(='>=' & Date(YearStart(Max(SoldDate), -1, 2), 'M/D/YYYY') & '<=' & Date(AddYears(Max(SoldDate), -1), 'M/D/YYYY'))",

"$(='>=' & Date(YearStart(Max(SoldDate), -2, 2), 'M/D/YYYY') & '<=' & Date(AddYears(Max(SoldDate), -2), 'M/D/YYYY'))",

"$(='>=' & Date(YearStart(Max(SoldDate), -3, 2), 'M/D/YYYY') & '<=' & Date(AddYears(Max(SoldDate), -3), 'M/D/YYYY'))"

}, SoldMonth, SoldYear>}ESTCUST)

View solution in original post

3 Replies
sunny_talwar

Try this

=Sum({<SoldDate = {

"$(='>=' & Date(YearStart(Max(SoldDate), 0, 2), 'M/D/YYYY') & '<=' & Date(AddYears(Max(SoldDate), 0), 'M/D/YYYY'))",

"$(='>=' & Date(YearStart(Max(SoldDate), -1, 2), 'M/D/YYYY') & '<=' & Date(AddYears(Max(SoldDate), -1), 'M/D/YYYY'))",

"$(='>=' & Date(YearStart(Max(SoldDate), -2, 2), 'M/D/YYYY') & '<=' & Date(AddYears(Max(SoldDate), -2), 'M/D/YYYY'))",

"$(='>=' & Date(YearStart(Max(SoldDate), -3, 2), 'M/D/YYYY') & '<=' & Date(AddYears(Max(SoldDate), -3), 'M/D/YYYY'))"

}, SoldMonth, SoldYear>}ESTCUST)

nareshthavidishetty
Creator III
Creator III
Author

Thanks..

How change the week start as Sunday by default the below logic shows from Monday.

=Sum({<SoldDate = {

"$(='>=' & Date(WeekStart(AddYears(Max(SoldDate), 0)), 'M/D/YYYY') & '<=' & Date(AddYears(Max(SoldDate), 0), 'M/D/YYYY'))",

"$(='>=' & Date(WeekStart(AddYears(Max(SoldDate), -1)), 'M/D/YYYY') & '<=' & Date(AddYears(Max(SoldDate), -1), 'M/D/YYYY'))",

"$(='>=' & Date(WeekStart(AddYears(Max(SoldDate), -2)), 'M/D/YYYY') & '<=' & Date(AddYears(Max(SoldDate), -2), 'M/D/YYYY'))",

"$(='>=' & Date(WeekStart(AddYears(Max(SoldDate), -3)), 'M/D/YYYY') & '<=' & Date(AddYears(Max(SoldDate), -3), 'M/D/YYYY'))"

}, SoldMonth, SoldYear>}ESTCUST)


Thanks..

sunny_talwar

Check here:

weekstart ‒ QlikView

=Sum({<SoldDate = {

"$(='>=' & Date(WeekStart(AddYears(Max(SoldDate), 0), 0, 6), 'M/D/YYYY') & '<=' & Date(AddYears(Max(SoldDate), 0), 'M/D/YYYY'))",

"$(='>=' & Date(WeekStart(AddYears(Max(SoldDate), -1), 0, 6), 'M/D/YYYY') & '<=' & Date(AddYears(Max(SoldDate), -1), 'M/D/YYYY'))",

"$(='>=' & Date(WeekStart(AddYears(Max(SoldDate), -2), 0, 6), 'M/D/YYYY') & '<=' & Date(AddYears(Max(SoldDate), -2), 'M/D/YYYY'))",

"$(='>=' & Date(WeekStart(AddYears(Max(SoldDate), -3), 0, 6), 'M/D/YYYY') & '<=' & Date(AddYears(Max(SoldDate), -3), 'M/D/YYYY'))"

}, SoldMonth, SoldYear>}ESTCUST)