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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Elofly
Frequent Visitor

Last Week Daily Sales Line Graph

Hi everyone!

 

I am trying to build a line graph where I have the following data:

- Y axe: Total Sales

- X axe: Days of the week (Monday, tuesday, etc.)

- Line A: Last week sales

- Line B: Previous last week sales

 

I was able to manage almost everything but I cannot seem to get both values in the same graph.

 

Can you help?

Thanks a lot!

 

1 ACCEPTED SOLUTION

Hi Freeman,

 

At the end I went for this:

Last Week TTV (-2) =
var LASTWEEK = WEEKNUM(TODAY()-7,2)
return
CALCULATE(SUM(vw_Becca_ZoeBookings[TotalPrice]),FILTER('Calendar Bookings','Calendar Bookings'[Week Number] = LASTWEEK))
 
Thanks a lot for your help!
 
Best regards,

View solution in original post

7 REPLIES 7
FreemanZ
Super User
Super User

That involves time intelligence functions. If you have a Date table, then it is easy. 
 
Supposing you have a measure for the current Total Sales name [Total Sales], then you can create two new measures with the code below:
 
Last Week Total Sales := CALCULATE ([Total Sales], DATEADD('Date'[Date], -7, DAY) )
 
Previous Last Week Total Sales := CALCULATE ([Total Sales], DATEADD('Date'[Date], -14, DAY) )
 
Plot all three measures in the same chart, then you see what you expect. 
 
Please come back, if you don't have a Date table. 

Hi !

Thanks for your quick answer. All good except, I dont have the WEEK option, only MONTH; YEAR, DATE, QUARTER, I guess I need to create it?

Thanks a lot for your help!

You are right, there is no WEEK interval. You can try -7 DAY and -14 DAY. 

Unfortunately, that would run weeks and not "calendar weeks" (from monday to sunday only)

What does that mean? Could you please provide a screenshot or upload the simplified report?

Hi Freeman,

 

At the end I went for this:

Last Week TTV (-2) =
var LASTWEEK = WEEKNUM(TODAY()-7,2)
return
CALCULATE(SUM(vw_Becca_ZoeBookings[TotalPrice]),FILTER('Calendar Bookings','Calendar Bookings'[Week Number] = LASTWEEK))
 
Thanks a lot for your help!
 
Best regards,

Glad to hear that. With WEEKNUM, we even don't need the Date table, bravo!!!

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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

Top Solution Authors