Set different day as start and end of the week in BIRT Report

MAX092012
edited February 11, 2022 in Analytics #1
Hi All,
Generally Monday is considered as start of the week and Sunday is considered as the end of week. I would like to understand whether there is a way to change this to start of the week = Wednesday and end of the week = Tuesday . User would be entering start date and end date as report parameter which would be typically for a month. For example 
start date = 04/01/2020 and end date = 04/30/2020 , below is the data present in the table and the output should be like second table 

I have been trying to do this using DB2 query however it doesnt seem to be achievable hence wanted to know if there is a way to achieve this using BIRT. 


column1 column2 Week
abc  64 1
abc  2 2
abc  50 3
abc  23 4
abc  22 5

Comments

  • jfranken
    edited May 26, 2020 #2
    Getting the week of the month with the week starting on Wednesday is possible in BIRT. 
    Create a computed column in the data set.  In the expression builder for the column, use the BirtDateTime functions.  The weekOfMonth method gets the standard week count.  I think you will need to get the day of week for the first day of the month.  If it is >= 4, then subtract 1 from the weekOfMonth only if the dayOfWeek is < 4, else add 1 to the weekOfMonth only if the dayOfWeek is >= 4. 
    Please test this logic carefully.
    Warning No formatter is installed for the format ipb