2 Replies Latest reply on Dec 8, 2016 4:32 AM by SANDIP SHARMA

    Current Year Weeks Date data comparison with last Year dates

    SANDIP SHARMA

      Hi There,

       

      I have an requirement to calculate the sales of last year based on current year weeks date.

       

      Week Logic: First Day of the week will be Monday and Data will be on Financial Year Bases (April onwards). So Week 1 will start in April onwards.

       

      Example:

      In Current Year 2016 my week-1 will start from 01-04-2016 (dd-mm-yyyy) to 03-04-2016 because my week start condition is Monday since 1 April is Friday for 2016 so only 3 days will be there on week 1. And week-2 will start from 04-04-2016 to 10-04-2016.

       

      I calculated the sales for week-1 for current year from 1 to 3 April 2016. Now I calculated the sales for the same date range for last year from 1 to 3 April 2015.

       

      For 2015: Week one started from 01-04-2015 and ends with 05-04-2015. I calculated till 3rd April 2015.

      Now I want to present the data on week on week for both the year.

      Problem Statement:

      What I did to achieve:

      As per below screenshot I have taken Week from Order Date and put it on row self and just to test put the day from order date and created the Flag to check the same dates for last year. and calculated the current and Previous year sale.

      As I have not split my window with year because of the same same in week one Tableau is superimposing dates of first week for both the year in one Pane. And again few dates are repeating in Week-2 as well because in current year week-2 start from 4 to 10 April.

       

      Due to this I am not able to achieve the same. I want apple to apple dates sales for week on week according to current year week dates only. Please help me how can I do this.

       

        • 1. Re: Current Year Weeks Date data comparison with last Year dates
          Patrick Van Der Hyde

          Hello SANDIP SHARMA,

           

          Have you looked through the examples here:  https://community.tableau.com/search.jspa?q=date&place=%2Fplaces%2F60090&depth=ALL  or FAQ:  To Date Calculations

           

          These examples with example workbooks should assist.  If additional assistance is still needed, please post a sample tableau workbook (.twbx) file showing the work attempted so far.  Also,  please let us know the version number of Tableau in use or else anyone assisting may post a response in newer version of Tableau (assuming you are on an older version). 

           

          Thanks


          Patrick

          • 2. Re: Current Year Weeks Date data comparison with last Year dates
            SANDIP SHARMA

            Hi Patrick,

             

            Thanks for your revert. I think you shared all the links related to date conversion or date format related and few of them are some level of calculation but problem is slight different from the url which you shared with me. Please read my requirement and help me with as it is creating to much problem. For now I have handled the same at database level till I get some workaround here in Tableau. There is a way in Tableau to achieve the same by duplicating the data source and filter the data according to the need of your problem in both the data set and then create a custom field for mobination on day and month then blend both the data set on the same and then you can achieve but I don't want to duplicate my datasource as I have very huge data which is taking hours to get the same. If I will use the same then I have to load the  twice one by one for both extract which will take some time to get the data.

            Please help me with some alternate, if you have.