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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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