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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
OntheDAXside
Frequent Visitor

Total hours for previous week and current week

 
Please I need help.

 

I have a data set and need to always calculate total hours for this week and previous week by refreshing the SQL data. I have used current week offset on my Calendar to get sum of this week and previous week using calculate function. Calculate([hours],'calendar', [curweekoffset]=0) what I need is the total sum of hours from inception to current week and previous week.

 

Thank you in anticipation.

1 ACCEPTED SOLUTION
v-rongtiep-msft
Community Support
Community Support

Hi @OntheDAXside ,

To get the total sum of hours from inception to the current week and previous week, you can modify your existing formula to include an additional filter condition that selects all weeks up to and including the current week and the previous week. Here's an example of how you can modify your formula:

Calculate([hours],'calendar', [curweekoffset]<=0 && [curweekoffset]>=-1)

This will calculate the sum of hours for all weeks where the current week offset is less than or equal to 0 ( the current week and all previous weeks) and greater than or equal to -1 (i.e., the previous week).

 

 

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

2 REPLIES 2
OntheDAXside
Frequent Visitor

Thank you @v-rongtiep-msft 

v-rongtiep-msft
Community Support
Community Support

Hi @OntheDAXside ,

To get the total sum of hours from inception to the current week and previous week, you can modify your existing formula to include an additional filter condition that selects all weeks up to and including the current week and the previous week. Here's an example of how you can modify your formula:

Calculate([hours],'calendar', [curweekoffset]<=0 && [curweekoffset]>=-1)

This will calculate the sum of hours for all weeks where the current week offset is less than or equal to 0 ( the current week and all previous weeks) and greater than or equal to -1 (i.e., the previous week).

 

 

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.