Forum Discussion
Comparing Daily Trend Year On Year
Hi there,
I hope you're well. I am new to Power BI and trying to buid a graph that would compare a daily trend for Internet traffic with a month on month comparison.
I used a DAX formula with a PARALLELPERIOD for the previous month's comparison but it is aggregating the sessions at the month level for the trendline (i.e. for each day of May it returns the May sum).
It would be great if anyone could help me with this, I would like to get the previous month's comparison as a daily trend.
Thanks for your help!
Hi RobinW2,
According to your description, I suppose you are using the following formula to generate the Lastmonth measure?
Comparison_before := calculate(sum('Table'[comparison]), PARALLELPERIOD('Table'[Date],-1,MONTH))
Please take a try to switch the PARALLELPERIOD function to DATEADD, then check to see if this would make it work.
Comparison_before := calculate(
sum('Table'[comparison]),
DATEADD('Table'[Date],-1,MONTH)
)
Regards
7 Replies
- v-micsh-msftMicrosoft Employee
Hi RobinW2,
According to your description, I suppose you are using the following formula to generate the Lastmonth measure?
Comparison_before := calculate(sum('Table'[comparison]), PARALLELPERIOD('Table'[Date],-1,MONTH))
Please take a try to switch the PARALLELPERIOD function to DATEADD, then check to see if this would make it work.
Comparison_before := calculate(
sum('Table'[comparison]),
DATEADD('Table'[Date],-1,MONTH)
)
Regards
- RobinW2Regular Visitor
Hi Michael,
I hope you're well. Thanks a lot for your answer, this the problem!
Have a good day.
Robin.
- RobinW2Regular Visitor
Hi everyone,
Just quickly reopening this thread as I am facing a new issue with the formula that calculates YoY data.
The formula is as follows:
Sessions Prev. Year = CALCULATE(SUM('Traffic'[Sessions]), DATEADD('Traffic'[Date Right Format], -1, YEAR))
However, when applying filters for half a month (e.g. 01/09 to 15/09), the previous year data calculates the whole September month rather than only for this data range.
Would anyone know what is causing the issue?
Thanks.
Robin.