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
erhan_79
Post Prodigy
Post Prodigy

Dinamically calculating based on per week

hi there 

 

i need a dax formula but in power bi , i have an table , that table has two column , one of the column name is "date" and has some dates , and the other column's name is "quantity" , this quantity named column has some quantities , i want to calculate the total quantity for each week of the current month, where a week starts on Monday and ends on Sunday.

 

Here is my table : cap-1.JPG

i want to calculate the total quantity for each week of the current month, where a week starts on Monday and ends on Sunday , as below table . 

 

cap-2.JPG

 

1 REPLY 1
amitchandak
Super User
Super User

@erhan_79 , Try a new column like

 

Month Week =
var _monthweek = (eomonth([Date],-1)+1) -WEEKDAY((eomonth([Date],-1)+1),2)+1 //monday
var _week = [Date] -WEEKDAY([Date],2)+1 //monday
return
QUOTIENT(DATEDIFF(_monthweek,_week,DAY),7)+1

 

 

Convert to text then

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.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

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