cancel
Showing results for
Did you mean:
Highlighted
Frequent Visitor

## How to get totals by week number

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team

## Re: How to get totals by week number

HI @Ben_Veritas ,

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 Sheng
If this post helps, please consider Accept it as the solution to help the other members find it more quickly
Learning resources: Power BI
3 REPLIES 3
New Contributor

## Re: How to get totals by week number

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]))

Community Support Team

## Re: How to get totals by week number

HI @Ben_Veritas ,

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 Sheng
If this post helps, please consider Accept it as the solution to help the other members find it more quickly
Learning resources: Power BI
Frequent Visitor

## Re: How to get totals by week number

Thanks for your help that worked

Announcements