Skip to main content

Hello guys, I need some help to solve this problem in my study.

 

I have a base with Managers and their sales for each month of the past year and the current year. I need to make a stacked bar graph showing the percentage of sales growth from one year to the next. However, I need to do the following calculation, I have to compare the average sales for each month of this year for each manager and compare it with the average sales for December for each manager.

On my panel, I need to have a filter with the base date, which in this case would be my last current month and another filter that could already be defined as December of the last year, but if I want to choose another month, I would be able to find the comparison between the selected month. And if I select more than a month, he makes the average between them.

 

I attached my base in excel and also my tableau that I managed to build

2 answers
  1. Jun 4, 2021, 12:44 AM

    @Jeyson Ferreira Alves​ This would be a great use case for sets. One of the newer features I really love is Show a set control in the view. This will allow your end users to select one or many dates in both the "base date" drop down and the "comparison date" dropdown without having to do anything special to override filters.

     

    For each the base dates and the comparison dates, I made a calculation like:

     

    IF [Select Base Dates] THEN [Sales] END

     

    And then I made a calculation that referenced these two calculations like:

     

    (ZN(SUM([Base Date Sales])) - ZN(SUM([Comparison Date Sales])))

    /

    ZN(SUM([Comparison Date Sales]))

     

    I've also attached the modified version of the workbook so you can explore what I did.

     

    Please @ me in replies otherwise I won't receive a notification. Vote for more notification options

     

    Hope this helps :)

    What do you think of the new Community Forums? Let us know!

    (Be sure to tag your ideas as 'community') 

0/9000