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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
thiagolb
Frequent Visitor

HELP: How to use SAMEPERIODLASTYEAR with condition

Hey guys,

 

I'm having issues when I try to compare relative dates with a condition.

 

I want compare relative days of the week, for example: 01-01-2018 was a monday, and 01-01-2018 was a sunday, so these two dates are no comparables to my demand. So I'd like to compare 01-01-2018 with 01-02-2017 to compare mondays with mondays, tuesday wit tuesday and so on.

 

Anyone know how to solve this problem?

1 ACCEPTED SOLUTION
v-jiascu-msft
Employee
Employee

Hi @thiagolb,

 

The week is a complicated thing. The weekday of 2016-01-01 is Friday. So I would suggest you create a new column of [Week Number Day]. The week number of a year is static and you can adjust it easily. The weekday is also static. Finally, those different days can be cited by the [Week Number Day].

WeekNumDay =
WEEKNUM ( [Date], 2 ) & "-"
    & WEEKDAY ( [Date], 2 )

HELP_How_to_use_SAMEPERIODLASTYEAR_with_condition

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-jiascu-msft
Employee
Employee

Hi @thiagolb,

 

The week is a complicated thing. The weekday of 2016-01-01 is Friday. So I would suggest you create a new column of [Week Number Day]. The week number of a year is static and you can adjust it easily. The weekday is also static. Finally, those different days can be cited by the [Week Number Day].

WeekNumDay =
WEEKNUM ( [Date], 2 ) & "-"
    & WEEKDAY ( [Date], 2 )

HELP_How_to_use_SAMEPERIODLASTYEAR_with_condition

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you Dale!

 

I did this and worked, the thing is, I wnated to show the dates as a subtitle in X axis but I think this is not possible.

 

Anyway, the dashboard is now working and showing the datas correctly.

 

Best regards.

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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