Pivot Table: Calculating Differences

Former Member
Former Member $organization

Hello Everyone! 

I am working on calculating the variance between tickets sold by week throughout different seasons. 

I am using the DIFFPASTYEAR formula but it is not returning the difference between tickets sold between seasons; instead it is just returning the tickets sold in the current season (just the count basically). 

I am attaching an excel file with the table I am trying to recreate in tessitura analytics as a pivot table. This way you can know what my data is and what variables I'm trying to use. 

I will also attach a screenshot of the the pivot table and formula I'm creating in Tessitura Analytics to illustrate the problem.

Any suggestions? 

Thank you for the help in advance!

Subscription Renewal Report Table.xlsx

Parents
  • Hi Rosanna,

    Let's ditch the DIFFPASTYEAR() function for this use case. The date-related Functions that are available in Tessitura Analytics all require a Date data type field to work (the fields with the little calendar icon next to them in the Data Browser). For any date dimension (collection of fields related to a given date) in Tessitura Analytics there are many fields we can choose from, allowing us to look at that date from many different angles and groupings. Week of Year is one example, but that's just a raw integer value in Analytics and not a Date data type that the date-related functions can work with.

    Likewise, those date functions, when grouped by Production Season as you have on Columns, would look for sales from the past year within the same Production Season grouping, and wouldn't be able to break out of any given Production Season to determine the sales figures from the prior Production Season.

    So to accomplish what it looks like you're after probably requires creating a formula using a conditional statement that determines is aware of Production Season is currently in scope. Or said another way, a formula that knows which Production Season the value is currently grouped within. Then based on that awareness, return the sales from the prior Production Season. One way to accomplish this might be to check whether the MAX Season Fiscal Year for any given Week of Production Season, is the Fiscal Year for a specific Production Season.

    We can use a condiditonal CASE statement to list many conditions to check in our formula, where each condition can use a different formula output. The result returned by the statement will be from the first condition in the list that is met. For your example, let's use a conditional check whether the MAX Season Fiscal Year = 2021, and if it does, return the [Total Ticket Count] from the Production Season, 1920 Broadway Morsani.

    CASE
    WHEN [Max Season Fiscal Year] = 2021
    THEN ( [Total Ticket Count] , [Production Season] )

    The THEN formula is a filtered value where the [Production Season] is set to 1920 Broadway Morsani. Because Formula filters override Widget and Dashboard filters, this filtered value will break out of the Production Season grouping on Columns and return the 1920 Broadway Morsani value to the 2021 Broadway Morsani grouping. Repeating this WHEN/THEN combination, and adjusting the Fiscal Year and selected Production Season for each, results in a full formula that looks something like this:

    CASE
    WHEN [Max Season Fiscal Year] = 2021
    THEN ( [Total Ticket Count] , [Production Season1] )
    WHEN [Max Season Fiscal Year] = 1920
    THEN ( [Total Ticket Count] , [Production Season2] )
    WHEN [Max Season Fiscal Year] = 1819
    THEN ( [Total Ticket Count] , [Production Season3] )
    ELSE NULL END

    The ELSE bit at the end is what the formula should return when none of the prior conditions is met. In this case I chose NULL or a blank value, rather than a 0. Finally, a CASE statement has to be closed with the END keyword.

    At this point we're close, but are only returning the Total Ticket Count from the prior Production Season, and not the difference. To do that, just add [Total Ticket Count] to the beginning of the formula, and subtract the CASE statement.

    Chris Wallingford
    Product Owner
    Tessitura Network
    office: +1 888.643.5778 x553
    chris.wallingford@tessituranetwork.com

Reply
  • Hi Rosanna,

    Let's ditch the DIFFPASTYEAR() function for this use case. The date-related Functions that are available in Tessitura Analytics all require a Date data type field to work (the fields with the little calendar icon next to them in the Data Browser). For any date dimension (collection of fields related to a given date) in Tessitura Analytics there are many fields we can choose from, allowing us to look at that date from many different angles and groupings. Week of Year is one example, but that's just a raw integer value in Analytics and not a Date data type that the date-related functions can work with.

    Likewise, those date functions, when grouped by Production Season as you have on Columns, would look for sales from the past year within the same Production Season grouping, and wouldn't be able to break out of any given Production Season to determine the sales figures from the prior Production Season.

    So to accomplish what it looks like you're after probably requires creating a formula using a conditional statement that determines is aware of Production Season is currently in scope. Or said another way, a formula that knows which Production Season the value is currently grouped within. Then based on that awareness, return the sales from the prior Production Season. One way to accomplish this might be to check whether the MAX Season Fiscal Year for any given Week of Production Season, is the Fiscal Year for a specific Production Season.

    We can use a condiditonal CASE statement to list many conditions to check in our formula, where each condition can use a different formula output. The result returned by the statement will be from the first condition in the list that is met. For your example, let's use a conditional check whether the MAX Season Fiscal Year = 2021, and if it does, return the [Total Ticket Count] from the Production Season, 1920 Broadway Morsani.

    CASE
    WHEN [Max Season Fiscal Year] = 2021
    THEN ( [Total Ticket Count] , [Production Season] )

    The THEN formula is a filtered value where the [Production Season] is set to 1920 Broadway Morsani. Because Formula filters override Widget and Dashboard filters, this filtered value will break out of the Production Season grouping on Columns and return the 1920 Broadway Morsani value to the 2021 Broadway Morsani grouping. Repeating this WHEN/THEN combination, and adjusting the Fiscal Year and selected Production Season for each, results in a full formula that looks something like this:

    CASE
    WHEN [Max Season Fiscal Year] = 2021
    THEN ( [Total Ticket Count] , [Production Season1] )
    WHEN [Max Season Fiscal Year] = 1920
    THEN ( [Total Ticket Count] , [Production Season2] )
    WHEN [Max Season Fiscal Year] = 1819
    THEN ( [Total Ticket Count] , [Production Season3] )
    ELSE NULL END

    The ELSE bit at the end is what the formula should return when none of the prior conditions is met. In this case I chose NULL or a blank value, rather than a 0. Finally, a CASE statement has to be closed with the END keyword.

    At this point we're close, but are only returning the Total Ticket Count from the prior Production Season, and not the difference. To do that, just add [Total Ticket Count] to the beginning of the formula, and subtract the CASE statement.

    Chris Wallingford
    Product Owner
    Tessitura Network
    office: +1 888.643.5778 x553
    chris.wallingford@tessituranetwork.com

Children