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
ctedesco3307
Resolver II
Resolver II

Concat Date Column to show in correct week order

Hello All: 

 

I have a calculated column in my calendar table that adds from and  to the Start an End Date

RepWeek = "From"&" "&TDate[WeekStartDate]&" "&"To"&" "&TDate[WeekEndDate]

For the visual (matrix). How can I make it show in the right date order by week?  

Thanks in advance!! 

 

ctedesco3307_0-1634836913991.png

ctedesco3307_1-1634836922512.png

 

 

3 ACCEPTED SOLUTIONS

Greg_Deckler_0-1634925220915.png

@ctedesco3307 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

@ctedesco3307 According to your image, you need to sort RepWeek by Week I am thinking. It looks like you are setting sort by on TDate and not sure why.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

@ctedesco3307 OK, so I have week starting and ending measures: Week Starting - Microsoft Power BI Community

 

Those are pretty long and complicated though so let's see if we can create better ones: 

WeekStartDate = TDate[Date] -  (WEEKDAY(TDate[Date],1) -1)
WeekEndDate = WeekStartDate + 6

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

11 REPLIES 11
ctedesco3307
Resolver II
Resolver II

@Greg_Deckler  - that's what I was looking for but I couldn't find the option to do that. Where is it? thx. 

Greg_Deckler_0-1634925220915.png

@ctedesco3307 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler well duh, I should have found that ... thank you but it didn't work for me. 

ctedesco3307_0-1634925872006.png

 

@ctedesco3307 Did you get an error?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler  no error, it just doesn't work. look at my pic in last post - the dates are still out of order 

thx

@ctedesco3307 According to your image, you need to sort RepWeek by Week I am thinking. It looks like you are setting sort by on TDate and not sure why.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

 @Greg_Deckler  Ah! Ok – so when I do that I do get an error, which is this:

ctedesco3307_0-1634990930590.png

 

Looking into it – it looks like my formula to set the WeekStartDate and WeekEndDate isn’t working right.  What those 2 columns are supposed to show, is the Sunday(WeekStartDate) and Saturday(WeekEndDate) for the Date column

Here are my formulas – it looks like when Date is Sunday the formula calculates the prior Sunday

WeekStartDate = TDate[Date] -  WEEKDAY(TDate[Date],2)

WeekEndDate = TDate[Date] -  WEEKDAY(TDate[Date],2)+6

ctedesco3307_1-1634990969453.png

 

 

@ctedesco3307 OK, so I have week starting and ending measures: Week Starting - Microsoft Power BI Community

 

Those are pretty long and complicated though so let's see if we can create better ones: 

WeekStartDate = TDate[Date] -  (WEEKDAY(TDate[Date],1) -1)
WeekEndDate = WeekStartDate + 6

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler This worked! thank you so much for your patience- this is exactly what I was looking for. I appreciate all your help here!  

ctedesco3307_0-1635006824362.png

 

 @Greg_Deckler  Ah! Ok – so when I do that I do get an error, which is this:

ctedesco3307_0-1634990930590.png

 

Looking into it – it looks like my formula to set the WeekStartDate and WeekEndDate isn’t working right.  What those 2 columns are supposed to show, is the Sunday(WeekStartDate) and Saturday(WeekEndDate) for the Date column

Here are my formulas – it looks like when Date is Sunday the formula calculates the prior Sunday

WeekStartDate = TDate[Date] -  WEEKDAY(TDate[Date],2)

WeekEndDate = TDate[Date] -  WEEKDAY(TDate[Date],2)+6

ctedesco3307_1-1634990969453.png

 

 

Greg_Deckler
Super User
Super User

@ctedesco3307 Well, you would need to use a Sort By column. You could likely use a WEEKNUM column for that.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.