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
ApurvaKhatri
Helper III
Helper III

Get week from Date

Hello,

 

How can i get weeek dates from a date column

 

E.g 

 

I have a column Spend and a Date column with continous dates (my spend amount is calculated on daily basis)

 

I need to calculate sum(spend) on weekly basis based on date column.

 

2017 - 10- 24      405

2017 -10- 23        200

2017-10-22    150

2017-10-21    100

2017-10-20     100

2017-10-19      125

2017-10-18     250

2017-10-17    150

2017-10-16   100

2017-10-15   50 

2017-10-14  500

2017-10-13  600

 

I need the sum for every week e.g 2017-10-14 to 2017-10-20  sum(spend)

How do i get week from dates and then calculate sum(spend)

 

I have data from 2016 Jan to date.

 

 

 

 

5 REPLIES 5
Santamaria5
Regular Visitor

Hola! 

Necesito presentar una grafica bisemanalmente del un año, no encuentro la manera de como realizarlo si hay alguna funcion que me ayude a que me agrupe los datos bisemanalmente

 

de esta manera

Santamaria5_1-1672322417847.png

 

 

v-jiascu-msft
Employee
Employee

Hi @ApurvaKhatri,

 

You said the dates are continuous. I am not going to create a new date table. 

1. Create a new Calculated Column "WeekNum".

WeekNum = WEEKNUM([Date] + 1,1)

2. Two measures.

StartOfWeek = min('Table1'[Date])
EndOfWeek = max('Table1'[Date])

3. Create a report. 

[Year]  [Weeknum]  [StartOfWeek]  [EndOfWeek] [Spend] (sum)Get week from Date.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Best Regards!

Dale

 

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
Super User
Super User

You can use WEEKNUM function in DAX in a calculated column to return the week of the year.


@ 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...

You also need to know if you are using ISO week numbers (Monday through Sunday), in which ALL weeks are complete weeks, or the default week numbering where January 1 is always week 1 and a new week starts on Sunday (e.g. Saturday Jan 1 is week 1 and Sunday Jan 2 is already week 2, which would still be ISO week 52 or 53).

Specializing in Power Query Formula Language (M)

We need the dates like start and end date of the week to be displayed 

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.