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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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