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
Anonymous
Not applicable

Week starts from today date (First day of the week will be the today date)

Need some help.
I want to sort the days in the chart (from right to left) for last 7 days but the first day of the week will be current day.
In the below screenshot friday is my current day. (this is how i want to sort as shown in the screenshot below).

Ali007_0-1665137185821.png

So , if  my current day is "Monday" then the sorting will look like (right to left). (monday to tuesday)


        tue     wed      thu      Fri       Sat      Sun      Mon

How can i achieve this please help !!!

1 ACCEPTED SOLUTION
Aburar_123
Resolver IV
Resolver IV

Hi @Anonymous ,

Table:-
Date_Dim = CALENDARAUTO(12)
 
Calculated Columns:-
Day Number = WEEKDAY('Date_Dim'[Date],2)
Week Day = FORMAT(Date_Dim[Date],"DDD")
Sort_Order =
var _curr_day = WEEKDAY(TODAY(),2)-'Date_Dim'[Day Number]
var a = WEEKDAY(TODAY(),2)+abs(WEEKDAY(TODAY(),2)-'Date_Dim'[Day Number])
return if(WEEKDAY(TODAY(),2)>='Date_Dim'[Day Number],_curr_day+1,a)
 
 

Aburar_123_0-1665154661142.png

 

and sort the "Week Day" column by Sort_Order column then use the "Week Day" column in the X-Axis.

it will start from today date from right

 

Aburar_123_1-1665154761534.png

 

 

Please accept it as a solution if it solves your problem. Thanks!

 

View solution in original post

5 REPLIES 5
Aburar_123
Resolver IV
Resolver IV

Hi @Anonymous ,

Table:-
Date_Dim = CALENDARAUTO(12)
 
Calculated Columns:-
Day Number = WEEKDAY('Date_Dim'[Date],2)
Week Day = FORMAT(Date_Dim[Date],"DDD")
Sort_Order =
var _curr_day = WEEKDAY(TODAY(),2)-'Date_Dim'[Day Number]
var a = WEEKDAY(TODAY(),2)+abs(WEEKDAY(TODAY(),2)-'Date_Dim'[Day Number])
return if(WEEKDAY(TODAY(),2)>='Date_Dim'[Day Number],_curr_day+1,a)
 
 

Aburar_123_0-1665154661142.png

 

and sort the "Week Day" column by Sort_Order column then use the "Week Day" column in the X-Axis.

it will start from today date from right

 

Aburar_123_1-1665154761534.png

 

 

Please accept it as a solution if it solves your problem. Thanks!

 

Aburar_123
Resolver IV
Resolver IV

Hi @Anonymous ,

 

You can achieve it as below,

 

Date Dim = CALENDARAUTO(12)
Day Number = WEEKDAY('Date Dim'[Date],2)
Expected_day_number =
var _curr_day = WEEKDAY(TODAY(),2)-'Date Dim'[Day Number]
var a = WEEKDAY(TODAY(),2)+abs(WEEKDAY(TODAY(),2)-'Date Dim'[Day Number])
return if(WEEKDAY(TODAY(),2)>='Date Dim'[Day Number],_curr_day+1,a)
Dinesh_Suranga
Continued Contributor
Continued Contributor

@Anonymous 

Hi

Do you have a calendar table?

If yes add a new column with first three letter of the day. Ex. Sun Mon.

Then filter date to top 7 days in the visual filters. Then order by descending.

Thank you.

 

Anonymous
Not applicable

Ali007_0-1665146052679.png

I have tried this before but it is not working. 

Ali007_1-1665146087976.png

Ali007_2-1665146108192.png

 

 

@Anonymous ,

 

1 Add a new table with latest 7 days of calender.

Dinesh_Suranga_0-1665147631122.png

2 Add Day column

3 Sort Day column by Date column

Dinesh_Suranga_1-1665147751156.png

 

4 Create relationship between calander table date column and new table date column.

5 Use new table Day column to visual.

Thank you

 

 

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.