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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
olimilo
Responsive Resident
Responsive Resident

Get minimum date value in week group based on WEEKNUM

Given the sample data below:

 

Date WeekNum
1/1/2023 1
1/2/2023 1
1/3/2023 1
1/4/2023 1
1/5/2023 1
1/6/2023 1
1/7/2023 2

 

WeekNum is a calculated column using WEEKNUM(). Is it possible to create a calculated column that says the "Week of" with the first date of that week?

 

Date WeekNum  Week Of
1/1/2023 1  Week of 01/01/2023
1/2/2023 1  Week of 01/01/2023
1/3/2023 1  Week of 01/01/2023
1/4/2023 1  Week of 01/01/2023
1/5/2023 1  Week of 01/01/2023
1/6/2023 1  Week of 01/01/2023
1/7/2023 2  Week of 01/07/2023

 

 

2 REPLIES 2
Dhairya
Solution Supplier
Solution Supplier

Hey @olimilo 
You can create the calculated column with the below DAX to get the expected output.

Minimum in week col =
CALCULATE(
    MIN(TableA[Date]),
    ALLEXCEPT(TableA,TableA[WeekNum])
)

Dhairya_0-1694694090468.png


If this helps you then please kudo my reply and mark it as accept as solution so that others cabn find it quickly while facing the similar issue. Thank You!

olimilo
Responsive Resident
Responsive Resident

This worked for me but I also found a different solution:

 

WeekOf = 
    CALCULATE(
        "Week of " & FORMAT(MIN('Data'[DATE]), "YYYY-MM-DD"),
        FILTER(
            'Data',
            'Data'[WeekNum] = EARLIER('Data'[WeekNum])
        )
    )

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Power BI Header Change

Power BI Header Update

Read about the exciting updates for the Power BI forum.

Top Solution Authors