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

Min - Max date display based on Week number

Hi,

 

I need some help with combining dates for displaying in a matrix, see below blue highlights ie. "1/Feb - 3/Feb" , "4/Feb - 10/Feb", "11/Feb - 17/Feb", "18/Feb - 24/Feb", "25/Feb - 28/Feb"

 

 

Week 5
1/Feb - 3/Feb
Mon-Thu
Fri-Sat
Week 6
4/Feb - 10/Feb
Mon-Thu
Fri-Sat
Week 7
11/Feb - 17/Feb
Mon-Thu
Fri-Sat
Week 8
18/Feb - 24/Feb
Mon-Thu
Fri-Sat
Week 9
25/Feb - 28/Feb
Mon-Thu
Fri-Sat

 

 

Currently, the Date table has these columns:

Date                    Date/Month     DayRange              DayShortName 

01/02/2019     1/2                          Fri - Sun               Fri

02/02/2019     2/2                          Fri - Sun               Sat

03/02/2019     3/2                          Fri - Sun               Sun

04/02/2019     4/2                          Mon - Thu           Mon

05/02/2019     5/2                          Mon - Thu            Tue

06/02/2019     6/2                          Mon - Thu           Wed

07/02/2019     7/2                          Mon - Thu            Thu

08/02/2019     8/2                          Fri - Sun               Fri

09/02/2019     9/2                          Fri - Sun               Sat

10/02/2019     10/2                         Fri - Sun               Sun

.. and so on...

 

I have tried this but it returned the same min and max date.

FormatDate = CONCATENATE(CONCATENATE(CALCULATE(MIN('Date'[Date/Month]), GROUPBY('Date', 'Date'[DayRange]))   , "-") ,  CALCULATE(MAX('Date'[Date/Month]), GROUPBY('Date',  'Date'[DayRange])    ))

 

Any help on this would be appreciated. Thanks

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

To achive the desired result, please go through the following steps.

 

Step1: Convert date into Week Start. Go to Edit Queries, and do as in the below screenshot.

Community Question2.png

Step2: Convert date into Week End. Same as above but select Week of End.

Community Question3.png

Make sure to choose the date format for the newly added columns.

Step3: Convert Week Start Date into DD/MMM. Use the below dax script.

           Week Start = FORMAT(SELECTEDVALUE(Dates[Start of Week]),"DD/MMM")
Step4: Convert Week End Date into DD/MMM. Use the below dax script.
          Week End = FORMAT(SELECTEDVALUE(Dates[End of Week]),"DD/MMM")

Step5: Combine results to get the desired output.

          Final Result = [Week Start] &" - "& [Week End]

 

This will give you that what you are looking for.

I have tested this and it is working fine.

Final Output will be like.

Community Question4.png

 

Please let me know if you have any questions. Happy to help you.

 

Regards,

Pavan Vanguri.

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Anonymous ,

 

To achive the desired result, please go through the following steps.

 

Step1: Convert date into Week Start. Go to Edit Queries, and do as in the below screenshot.

Community Question2.png

Step2: Convert date into Week End. Same as above but select Week of End.

Community Question3.png

Make sure to choose the date format for the newly added columns.

Step3: Convert Week Start Date into DD/MMM. Use the below dax script.

           Week Start = FORMAT(SELECTEDVALUE(Dates[Start of Week]),"DD/MMM")
Step4: Convert Week End Date into DD/MMM. Use the below dax script.
          Week End = FORMAT(SELECTEDVALUE(Dates[End of Week]),"DD/MMM")

Step5: Combine results to get the desired output.

          Final Result = [Week Start] &" - "& [Week End]

 

This will give you that what you are looking for.

I have tested this and it is working fine.

Final Output will be like.

Community Question4.png

 

Please let me know if you have any questions. Happy to help you.

 

Regards,

Pavan Vanguri.

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.