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
Anonymous
Not applicable

How can I display visits from last year in a line chart in Power BI?

Hi everyone,

 

I'm working on a line chart in Power BI that shows the number of visits to our website over time, with the chart currently set up to display visits by day in 2023. I'm using a measure called "Unique Visits" to calculate the distinct count of visit IDs from our website data source.

I'd like to compare the visits from the same time period in the previous year (i.e. January 2022 through December 2022) to the visits this year, but I'm having trouble getting the visits from last year to display in the chart. I've tried creating a new measure using the DATEADD function to subtract a year from the date, but this hasn't worked.

Here's the formula I used for the new measure:

 

 
Unique Visits Last Year = CALCULATE( DISTINCTCOUNT('Website Data'[Visit ID]), DATEADD('Website Data'[Date], -1, YEAR) )

Can anyone help me figure out why the visits from last year aren't displaying in the chart?

P.s. I also have a filter on the page that has selected the period of first quarter of 2023.

See picture below:

LaZZaNoVa61_0-1679829312362.png

 

0 REPLIES 0

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.