cancel
Showing results for
Did you mean:
Regular Visitor

## Help with DAX - Week to date last selected Week

Hello,

I am creating a formula in DAX with which we want to calculate the sales week to date.

We have a report with a date filter and an amount to be shown per weekday, only from the last filtered week.

The date filter can be selecterd for a longer period than one week, and we are looking for a formula that returns the amount of sales for the last selected week, shown per weekday.

Example:

 Date Weekday SalesAmount 15-05-2023 Monday 10 16-05-2023 Tuesday 25 17-05-2023 Wednesday 20 18-05-2023 Thursday 25 19-05-2023 Friday 10 20-05-2023 Saturday 25 21-05-2023 Sunday 30 22-05-2023 Monday 10 23-05-2023 Tuesday 30 24-05-2023 Wednesday 25 25-05-2023 Thursday 50 26-05-2023 Friday 10 27-05-2023 Saturday 35 28-05-2023 Sunday 10

In the report i have filtered the intire period. From 15-05-2023 till 25-05-2023. What I want is the sales amount, shown per weekday only of the last selected week.

So what I expect to see in the report is:

 Monday22-05-2023 Tuesday23-05-2023 Wednesday 24-05-2023 Thursday 25-05-2023 10 30 25 50

Thank you so much!

1 ACCEPTED SOLUTION
Solution Sage

Hello @EsmeeSnijders  i hope this helps you!THANK YOU!!

First your create WEEKNUM Column :

WeekNum = WEEKNUM('Table'[Date],2)

Then create measure  :
MXweek = MAX('Table'[WeekNum])

after that apply Matrix visual level filter

@EsmeeSnijders THANK YOU!!

2 REPLIES 2
Solution Sage

Hello @EsmeeSnijders  i hope this helps you!THANK YOU!!

First your create WEEKNUM Column :

WeekNum = WEEKNUM('Table'[Date],2)

Then create measure  :
MXweek = MAX('Table'[WeekNum])

after that apply Matrix visual level filter

@EsmeeSnijders THANK YOU!!

Regular Visitor

It works!! Thank you so much!

Announcements

#### Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

#### Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

#### Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Top Solution Authors
Top Kudoed Authors