Forum Discussion

bitraveldepart's avatar
bitraveldepart
Frequent Visitor
8 years ago
Solved

Incremental Values/ group by Relative week

Hi,

 

 

I'd like to see the incremental Pax number from the beginning of the year till now and compare the rate of target.

So I have my Pax number for each booking record with date, relative week, month and year.

 

Original table as follow:

Tour_IDBook DateMonthRelative weekPax
100101/01/2017113
100222/01/2017141
100303/02/2017252
100404/02/2017255


then sum up the incremental Pax number by Relative week:

Relative weektotal Pax
13
44
511

 

and come up with something like

 

The dataset is more complex but this is basically the idea. Anyone knows how to transfer the original table (by Tour_ID) to another table (by Relative week) and sum up the incremental value as well?

 

Thanks!

  • Create a summary table, grouping by week and SUM the passengers

    sumtab = SUMMARIZE(TourPassengers, 
         TourPassengers[RelativeWeek],  
         "total Pax", SUM(TourPassengers[Pax]))

    Then add a calculated column for cumulative totals

    CumulPax = CALCULATE ( SUM(sumtab[total Pax]),
        			FILTER (  
        			ALL ( sumtab ),
            		sumtab[RelativeWeek] <= EARLIER ( sumtab[RelativeWeek])))

5 Replies

  • HotChilli's avatar
    HotChilli
    Icon for Community Champion rankCommunity Champion

    Create a summary table, grouping by week and SUM the passengers

    sumtab = SUMMARIZE(TourPassengers, 
         TourPassengers[RelativeWeek],  
         "total Pax", SUM(TourPassengers[Pax]))

    Then add a calculated column for cumulative totals

    CumulPax = CALCULATE ( SUM(sumtab[total Pax]),
        			FILTER (  
        			ALL ( sumtab ),
            		sumtab[RelativeWeek] <= EARLIER ( sumtab[RelativeWeek])))
    • bitraveldepart's avatar
      bitraveldepart
      Frequent Visitor

      Hi,

       

      My [Relative Week] is a column not meature. Therefore it doesn't recognize the column from the table.

      Does it make sense?

       

      Thanks,

      • HotChilli's avatar
        HotChilli
        Icon for Community Champion rankCommunity Champion

        I think that's just a syntax error.  You'll need to change the code i submitted so that it works with your tables/columns e.g my sample table is 'RelativeWeek' but yours should have a space in there