Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Using Measure to Compare Current Period to Previous Period

Hi Everyone, I am currently using the measure below to compare the current period and the previous period, but since the measure is going back by number of days I am running into a problem. For ex...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Everyone,

     

    Here is the solution that I have found to work. I hope someone finds this useful. I will give credit to the freelancer who came up with this at the end of the post.

    End Result:

    You will have one slicer for the current period and one slicer for the previous period. You can compare any range of dates to one another by selecting your date range in the corresponding slicer. In the photo below the current period slicer is showing 6/1/2021-6/30/2021 and the previous period slicer is showing 5/1/2021-5/31/2021. The light blue line is showing the current period and the dark blue line is showing the previous period in the visuals.

     

    Step 1:

    Create a new measure called "Previous Date Selector" and use your date table as the parameter value.

     

    Step 2:

    Create an inactive one too many relationship between your "Previous Date Selector" and regular date table.

     

    Step 3:

     

    Create a slicer from your standard date table and name it "current period" and create a slicer from your "previous date selector" and name it "previous period."

     

     

     

    Step 4:

    Create a measure with the following dax. In this case, I am comparing total sessions in the current period to total sessions in the previous period so I am using the "total sessions" value.

     

     

    Step 5

    Add your two values to the visual you would like to use to compare the current period to the previous period. In this case, I am comparing total sessions from google analytics so I have a measure for "total sessions", which is synched to the current period slicer and a measure for "total visitors for previous period", which is synched to the previous period slicer.

     

    I hope this helps someone! 

     

    Freelancer: andystepas | Profile | Fiverr