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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

How to get totals by week number

Hi, this maybe really simple to answer but as im new to this and have not found the answer online after a few hours and countless videos online please help.

 

I have a custom calender and would like to get the totals of each week number.  As this will be over a few years i would like to get the wekly totals from Years & Week.  I think i need to create a new column with week totals in?  It sfor week on week comparisons but i cant figure out the weekly totals to get that far yet.  Thanks for your help in advance.

 

Screenshot 2019-12-06 at 13.38.20.png

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

HI @Anonymous ,

I'd like to suggest you use year and week number as filter conditions to aggregate values.

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

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

3 REPLIES 3
v-shex-msft
Community Support
Community Support

HI @Anonymous ,

I'd like to suggest you use year and week number as filter conditions to aggregate values.

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

Regards,

Xiaoxin Sheng

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

Thanks for your help that worked 

PaulDBrown
Community Champion
Community Champion

@Anonymous 

Try this:

create measure for daily totals = SUM(dCalender[Daily Total])

 

and then create new measure along the lines of:

year and week totals = CALCULATE([daily totals], ALLEXCEPT(dCalender[Year & Week]))





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.