cancel
Showing results for
Did you mean:
Frequent Visitor

## Week Sunday to Saturday and also the last week ( show sunday to saturday)

Hi everyone,
I am here again with more doubts to solve, can anyone help me? jeje

I need to calculate the weeks Sunday to Saturday.
I did this logic with the normal week of 7 days and Monday to Sunday

``````Last Week Current Date tmp =
var dies = if (DAY(TODAY()) <> 7, 7, 6)
var data_setmana_anterior = DATE(YEAR(TODAY()),MONTH(TODAY()),DAY(TODAY())-dies)
return
if(WEEKNUM('Dim Calendar'[Date],2) = WEEKNUM(data_setmana_anterior,2) ,"Last Week",FORMAT(WEEKNUM('Dim Calendar'[Date],2),"00"))``````

Basically, I think I need a DAX formula to get last week's values between Saturday and Sunday.
Kind regards,
att:JoanElGran

2 ACCEPTED SOLUTIONS
Frequent Visitor

Hi @v-yangliu-msft ,
First of all thanks for your help, but what I want is this but the week i want to Sunday to Saturday.
Like this:

Cheers,
Joan

Community Support

Here are the steps you can follow：

1. Create calculated column.

``````Last week weekend =
var _today=TODAY()
var _weektoday=WEEKNUM(TODAY(),1)
var _week1=WEEKDAY('Dim Calendar'[Date],2)
return
IF(
WEEKNUM('Dim Calendar'[Date],1)=_weektoday-1,"Last week",FORMAT(WEEKNUM('Dim Calendar'[Date],1),"00")
)``````
``````week1 =
WEEKNUM('Dim Calendar'[Date],1)``````
``````Week2 =
FORMAT( WEEKDAY('Dim Calendar'[Date],1),"dddd")``````

2. Result:

Does the result meet your expectations.

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

3 REPLIES 3
Community Support

Here are the steps you can follow：

1. Create calculated column.

``````Last week weekend =
var _today=TODAY()
var _weektoday=WEEKNUM(TODAY(),1)
var _week1=WEEKDAY('Dim Calendar'[Date],2)
return
IF(
WEEKNUM('Dim Calendar'[Date],1)=_weektoday-1,"Last week",FORMAT(WEEKNUM('Dim Calendar'[Date],1),"00")
)``````
``````week1 =
WEEKNUM('Dim Calendar'[Date],1)``````
``````Week2 =
FORMAT( WEEKDAY('Dim Calendar'[Date],1),"dddd")``````

2. Result:

Does the result meet your expectations.

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Community Support

Here are the steps you can follow：

1. Create calculated column.

``````Last week weekend =
var _today=TODAY()
var _weektoday=WEEKNUM(TODAY(),2)
var _week1=WEEKDAY('Dim Calendar'[Date],2)
return
IF(
WEEKNUM('Dim Calendar'[Date],2)=_weektoday-1 &&_week1 in {6,7},"Last week weekend",FORMAT(WEEKNUM('Dim Calendar'[Date],2),"00")
)``````

2. Result:

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Frequent Visitor

Hi @v-yangliu-msft ,
First of all thanks for your help, but what I want is this but the week i want to Sunday to Saturday.
Like this:

Cheers,
Joan

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!

#### Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors
Top Kudoed Authors