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
Anonymous
Not applicable

how to calculate monday to sunday values

Hi 

How to calculate sum of  this week monday to sunday values and following week monday to sunday values.

example

this monday to friday 23/03/2010 - 29/03/2020

following monday 30/03/2020 - 05/04/2020

 

Thanks in anticipation

Kavitha ghosh

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

Hi @Anonymous,

In fact, you can use year and weeknum function as conditions to compare with date field to lock on a specific week range.
After these steps, you only need to write a common rolling calculation formula with the above conditions to achieve your requirement about weekly rolling total:

Measure =
VAR currDate =
    MAX ( Table[Date] )
RETURN
    CALCULATE (
        SUM ( Table[Amount] ),
        FILTER (
            ALLSELECTED ( Table ),
            WEEKNUM ( [Date], 2 ) = WEEKNUM ( currDate, 2 )
                && YEAR ( [Date] ) = YEAR ( currDate )
                && [Date] <= currDate
        )
    )

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

Hi @Anonymous,

In fact, you can use year and weeknum function as conditions to compare with date field to lock on a specific week range.
After these steps, you only need to write a common rolling calculation formula with the above conditions to achieve your requirement about weekly rolling total:

Measure =
VAR currDate =
    MAX ( Table[Date] )
RETURN
    CALCULATE (
        SUM ( Table[Amount] ),
        FILTER (
            ALLSELECTED ( Table ),
            WEEKNUM ( [Date], 2 ) = WEEKNUM ( currDate, 2 )
                && YEAR ( [Date] ) = YEAR ( currDate )
                && [Date] <= currDate
        )
    )

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
amitchandak
Super User
Super User

@Anonymous  , You can create a date calendar and week start and week end based on that. You can create a week name based on that. Refer, how to so in the calendar and how to use it

 

https://www.dropbox.com/s/a9xq913pgvuzg2x/sales_analytics_weekWiseMon_sun.pbix?dl=0

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

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.