Forum Discussion
Custom Comparison Period calculations not working correctly in visuals with dates
Nawalasim8 , refer if this approach can help
How to use two Date/Period slicers
Hello, thanks for the response.
This approach doesnt fulfill the month over month comparison the way i've mentioned in the post. When i use Month as a dimesntion it is from the primary date dim table and since im using the following calculations to show the comparison period for the metric alongside on the same graph:
Any idea on how i can achieve this?
- Anonymous1 year agoNot applicable
Hi Nawalasim8 ,
Thank you for the detailed clarification. You're correct in observing that the current approach compares each month in the current period against the entire comparison period total, due to the way the pageviews_previous measure is structured with ALL(dimdate) and USERELATIONSHIP.
To achieve a month-by-month alignment (e.g., Oct 2024 → Jan 2024, Nov → Feb, etc.), you will need to match each selected month in the current period with its counterpart in the comparison period based on position/order, not on calendar date.
Please follow the below recommended approach:
- Add an index column (DateIndex) in both your primary (dimdate) and comparison (dimdate2) date tables to reflect date sequence.
- Create a revised measure that uses the current row’s DateIndex to find the corresponding date in the comparison period and retrieve the value from there.
- This way, each month in the visual will be correctly compared to the aligned month from the comparison period (if available).
This approach avoids the issue of aggregating over the full comparison period and instead performs a one-to-one alignment by position, fulfilling your intended behavior.
I hope this will help you understand better, if you need any further assistance, feel free to reach out.
If this post helps, then please give us Kudos and consider Accept it as a solution to help the other members find it more quickly.
Thankyou.
- Anonymous1 year agoNot applicable
Hi Nawalasim8 ,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.