# Community Corner

Discussion board for questions about the Qlik Community, its features, sharing information, general discussions and even some fun. This is for both new and longtime community members. Everyone is welcome!

cancel
Showing results for
Did you mean:
Highlighted
Partner

## Comparing semester selected vs previous

Hi, I need to display data comparing similar periods against their previous period (Month, Quarter and Semester). The problem is that when user select the current period (unclosed period) we should compare it with the same number of days in the previous period. I applied this logic with Month an Quarter using MonthStart and QuarterStart functions, and it works:

InMonthToDate([Day], Today(), 0) * -1 AS [CurMTDFlag], //Current Month Flag

if ([Day]>=date(MonthStart(Today(), -1),'DD/MM/YYYY') and [Day]<=date(MonthStart(Today(), -1)+(Today()-MonthStart(Today(), 0)),'DD/MM/YYYY'),1,0) as [PrMTDFlag], //Prior Month Flag

InQuarterToDate([Day], Today(), 0) * -1 AS [CurQTDFlag], //Current Quarter Flag

if ([Day]>=date(QuarterStart(Today(), -1),'DD/MM/YYYY') and [Day]<=date(QuarterStart(Today(), -1)+(Today()-QuarterStart(Today(), 0)),'DD/MM/YYYY'),1,0) as [PrQTDFlag], // Prior Quarter Flag

if (InMonths(6,[Day], Today(),0), 1, 0) AS [CurHYTDFlag] //Current Semester Flag

Now, I have this problem:

- How can I apply the same logic for previous SEMESTER (Always considering Semester 1 as Jan-Jun and Semester 2 as Jul-Dec)?

Thanks a lot!

Labels (3)

• ### QlikView

2 Replies
Highlighted
Partner

I have the same problem!! In my case I need to be able to switch between Months (comparing the selected month with its previous), does anyone know any solution?

Thanks!

Highlighted
Community Manager

@JaviValtu Are you using QlikView or Sense? I would like to move this into the correct product forum. Thank you.

Sue Macaluso
Community Browser