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

Sum of Value of Current Week to Next 3 Weeks

Hi All,

 

I'm trying to write a DAX code to calculate the sum of values between current week to next 3 weeks.

I have written the following DAX code:

 

Hours for next 3 weeks = 
CALCULATE(SUM('Resource Management'[Hours]),DATESINPERIOD('Calendar'[Date],TODAY(),28,DAY))

 

However, the above code does not take the current week values in consideration.

The example is below where the graph is showing the current result but not the table and ignoring the current week values:

jnnilesh29_0-1603221161849.png

I have the weekday column in my sheet as shown below:

jnnilesh29_1-1603221244848.png

Could you please help me to write a current DAX code?

 

Your help is appreciated.

 

Thanks,

Nilesh

1 ACCEPTED SOLUTION

For someone who is looking for the solution for the sum of values between the current week to the next 3 weeks:

Hours for next 3 weeks = 
CALCULATE
(SUM('Resource Management'[Hours]),
FILTER(ALL('Resource Management'[WEEK NUMBER]),
'Resource Management'[WEEK NUMBER]>=WEEKNUM(TODAY(),1) && 'Resource Management'[WEEK NUMBER]<=WEEKNUM(TODAY(),1)+3))

 

Thanks,

Nilesh Jain

View solution in original post

3 REPLIES 3
themistoklis
Community Champion
Community Champion

@jnnilesh29 

 

If you have a week number field (anging from 1-53) you can use the following formula:

Hours for next 3 weeks = 
CALCULATE(SUM('Resource Management'[Hours]),
    FILTER (
        ALL ( Calendar ),
        Calendar[WeekID]
            >= MAX ( Calendar[WeekID] ) 
            && Calendar[WeekID] <= MAX ( Calendar[WeekID] + 3 )
    )
)

Thanks for your reply @themistoklis 

jnnilesh29_0-1603228833132.png

I have created a separate WEEKNUM column in my sheet but I'm getting the above error.

The following is the link to the file. Please let me know if you cannot access it. 

 

https://www.dropbox.com/s/twnck91v5tbe65s/Resource%20Management%20-%20Power%20BI.pbix?dl=0 

 

I'm looking forward to hearing from you.

 

Thanks and Regards,

Nilesh

 

For someone who is looking for the solution for the sum of values between the current week to the next 3 weeks:

Hours for next 3 weeks = 
CALCULATE
(SUM('Resource Management'[Hours]),
FILTER(ALL('Resource Management'[WEEK NUMBER]),
'Resource Management'[WEEK NUMBER]>=WEEKNUM(TODAY(),1) && 'Resource Management'[WEEK NUMBER]<=WEEKNUM(TODAY(),1)+3))

 

Thanks,

Nilesh Jain

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.