Skip to main content
Hamid R a posé une question dans Newbie Tableau User Group Desktop

Hi Tableau Community, 

 

I have a simple tableau setup with some sample revenue by month across 3 years of data. I created a parameter (Revenue View .P) which switch between a monthly and cumulative view. I also have another parameter (Compare By .P) which when switched between "vs Last Year" or "vs Last Month" would show % difference (increase or decrease) between current hovered month vs based on the selected parameter vs Last Year same month or vs Last Month on the same year. It should work exactly the same whether the Revenue View .P is monthly or cumulative view. 

 

How can I implement this? 

2 réponses
  1. 11 oct., 02:27

    Hi Hamid,

    I'm also learning Tableau, so I tried working through this problem myself.

    Here's what worked for me:

    1. I created a Year Month Date field using:

    DATEPARSE("yyyy-MM", [Year Month])

    I used RUNNING_SUM() in the Toggle Revenue calculation to switch between monthly and cumulative revenue.

    1. For Comparison Revenue, I used LOOKUP() to compare against the previous month (-1) or the same month last year (-12), depending on the parameter.
    2. The key part was the table calculation settings. Under Specific Dimensions, I added Month so that the comparison values would display correctly.
    3. For cumulative revenue with month-over-month comparison, I also set January's comparison value to NULL, since the cumulative total resets at the beginning of each year.

    I'm still learning Tableau myself, so there may be other ways to do this, but hopefully this helps!

0/9000