cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors