Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
RobinW2
Regular Visitor

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!

Issue.PNG

1 ACCEPTED SOLUTION
v-micsh-msft
Employee
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

 

View solution in original post

7 REPLIES 7
v-micsh-msft
Employee
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

 

Hi Michael,

 

I hope you're well. Thanks a lot for your answer, this the problem!

 

Have a good day.

 

Robin.

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.

Thanks for posting this - this definitely worked with the DATEADD - I then showed a YoY for the month using the Area Chart and selected the month itself (but used DateKey) DateKey being from my Date Dimension table .

Hi RobinW2,

Apologize for the late response. This might be related with the DATEADD function. DateAdd function only returns a single column of Datekey which overwrites existing filter on the same column.

I would try to create some tests on this, will share the results once I finished.

A blog for reference:

http://mdxdax.blogspot.sg/2011/01/dax-time-intelligence-functions.html

Regards

 

Hi Michael,

 

I hope you're well and thanks a lot for coming back to me. I have actually fixed the answer by extending the dates after my last date on the excel file from which I pull the data. 

 

It seems that Power BI was automatically recognising the September 2016 data as a full month (as there was no date beyond the 25/09 initially) and replicating this set up on the 2015 comparison.

 

Thanks for your help!

 

Robin.

OK。

Thanks for sharing this.

If any further questions when using Power BI, please feel free to post in this forum.

Regards

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors