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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

How to Sum values for each Week based on it's week sequence

Hi everyone,

I need help to create 4 measures, one measure to calculate the sum of sales based on the week,

For example,

I want one measure to calculate the sum of sales for the first week of the current month filtered, then another measure to calculate the sum of sales for the second week, another for the third, and a last one for the fourth week,

I need these measures to be flexible because my month column will be changing regularly, 

 

RodCamargoJr_0-1684242966606.png


For example, using my table above as a reference, I would like to get a measure showing a total of (28+58=86) for the first week, which is "18", when I'm seeing the Month "Mai", then a second measure showing a total of 27, because the second week is "19".

I've tried to use the formula "MIN", I've got for the first week, but for the week onwards, if I sum a "+1" at my "MIN" to get the second-week result for example, Power BI doesn't recognize my command. 

Thank you for your help.

2 REPLIES 2
FreemanZ
Super User
Super User

hi @Anonymous 

try like:

measure1 =
VAR MinWeek = MINX(ALLSELECTED(data), data[Week])
RETURN
MINX(
FILTER(
data,
data[week]=MinWeek
),
data[Sales]
)

measure2 =
VAR MinWeek = MINX(ALLSELECTED(data), data[Week])
RETURN
MINX(
FILTER(
data,
data[week]=MinWeek+1
),
data[Sales]
)

...

Anonymous
Not applicable

Hi @FreemanZ ,

The "+1" into the MinWeek doesn't work here, 
The first measure is working just fine,

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.