Forum Discussion
Using Measure to Compare Current Period to Previous Period
- Anonymous5 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
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
Hi,
this is exactly what I am trying to achieve but I am having an issue with step 1: "Create a new measure called "Previous Date Selector" and use your date table as the parameter value."
My date field doesn't show up as a date in the parameter and it looks like I cannot use it for anything.
This is an old post but I hope someone can help me figure out what might be wrong.
Thanks!