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
Hodgey87
Regular Visitor

Group by week ... Newbie

Hi Guys,

Firstly sorry to be a pain ... I've been asked to produce a dashboard initially for sales per day compared to last year which is working fine. Could I ask what would be the best way to group this table by week number? I.e. Week 1 and total sales, week 2 and total sales. 

Could I use some sort of if statement?

 

F36F869B-8118-4982-9E69-3614EBC03F5A.jpeg

1 ACCEPTED SOLUTION
v-xicai
Community Support
Community Support

Hi @Hodgey87 ,

 

You may create measure like DAX below.

 

Week_Sum=CALCULATE(SUM(Table1[Sales]),FILTER(ALLSELECTED(Table1), YEAR(Table1[date]) =YEAR(MAX(Table1[date]))&&WEEKNUM(Table1[date]) =WEEKNUM(MAX(Table1[date]))))

 

Best Regards,

Amy 

 

Community Support Team _ Amy

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
v-xicai
Community Support
Community Support

Hi @Hodgey87 ,

 

You may create measure like DAX below.

 

Week_Sum=CALCULATE(SUM(Table1[Sales]),FILTER(ALLSELECTED(Table1), YEAR(Table1[date]) =YEAR(MAX(Table1[date]))&&WEEKNUM(Table1[date]) =WEEKNUM(MAX(Table1[date]))))

 

Best Regards,

Amy 

 

Community Support Team _ Amy

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

az38
Community Champion
Community Champion

@Hodgey87 

sales that you want to sum up are measures or columns?

if columns - you can just aggregate it in visual fields settings

if measures you can try a new measure like

Measure = CALCULATE(SUMX(Table, Table[Sales Variance]), ALLEXCEPT(Table, Table[Week Number]))

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

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.