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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
DimaMD
Solution Sage
Solution Sage

Calculate week values having daily ones

Hello Community

We have following data:

IDDateValue
1

01.12.2021

500000

 

For our task, the table means that value of 500000 is for december (because date is 01.12). The next step we do is calculate value for each day of december. For that reason we count how much days are in december (31) and then divide 500000 with 31. The result is 16129 for each day.

 

The next step must be that we will show table which consist of ID, number of week (in our case in december) and value, that must be count as 16129 * "amount of days in week". The result must be as following

 

ID4950515253ALL
1806451129031129031129038064550000

So what it shows?

Week 49 and week 53 has 5 days each in december, so we multiply 16129*5=80645

Week 50-52 have 7 days each, so result is 16129*7=112903

Summary of december is 500000 as it was in default value written in the beginning.

 

Question is - how can i calculate this in DAX 🙂

Thank you in advance!


__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com
1 ACCEPTED SOLUTION
DimaMD
Solution Sage
Solution Sage

After making some calculations, I got the desired result
Screenshot_13.jpg
Auxiliary measure was "Number of selected days":

Number of selected days = DATEDIFF(MIN('Dates'[Date]),MAX(Dates[Date]),DAY)+1

__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com

View solution in original post

3 REPLIES 3
DimaMD
Solution Sage
Solution Sage

After making some calculations, I got the desired result
Screenshot_13.jpg
Auxiliary measure was "Number of selected days":

Number of selected days = DATEDIFF(MIN('Dates'[Date]),MAX(Dates[Date]),DAY)+1

__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com
VahidDM
Super User
Super User

Hi @DimaMD 

 

You can add a calendar (date) table to your model and then use that to find the solution.

https://www.vahiddm.com/post/creating-calendar-table-with-3-steps

 

you need to use something like this to find the days in the week:

calculate(countrows(date[date]),filter(all(date),date[week No.]=WEEK No.)) for instance 49

 

share sample of your data in a text format.

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

hi, @VahidDM 
Example data


__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors