cancel
Showing results for
Did you mean:

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

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
Frequent Visitor

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,
7 REPLIES 7
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.
Frequent Visitor

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!

Super User

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

Frequent Visitor

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

Super User

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

Frequent Visitor

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,
Super User

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

Announcements

#### Power BI Monthly Update - November 2023

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

#### Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

#### The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors