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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Andregewehr
Helper I
Helper I

Sum based on accumulated values

Hi people!

 

I have the following table with id_product, date, sells and available_minutes. Every day the database is updated, to check how many sells the product was for sale. The available_minutes is to check if the product has stock above zero.  As I want the average sales (sales/week), if I make a calculation divided by 1 week, I will be considering when there is zero stock. So I want to consider the period of 1 week that the stock is available.

 

So I created a measure of cumulative sum of minutes:

_accumulate_minutes = CALCULATE(sum('Table'[available_minutes]),FILTER(ALL('Table'[date]),[date]<=MAX('Table'[date])))

 

So I have this table

01.JPG

 

As you can see, the total sum for the measure is wrong. I think I should try summarize or addcollumns, but I already tried and did not get the result. But what I really want is to sum the sells for 1 period and 2 periods for each id_product. Each period has 10.080 minutes, so 1 period is 10080 and 2 periods 20160. 

02.jpg

 

Hope someone can help me 🙂

 

Thanks!

 

André Gewehr

3 REPLIES 3
Andregewehr
Helper I
Helper I

I think I made it clear, I want the sum of sales depending on the values of the accumulated minutes.

 

Andregewehr
Helper I
Helper I

Sorry,

 

For the id_product (1) and for each period, I want the following sum of sells:

- If accumulate minutes <= 10080, sum sells = 10

- If accumulate minutes <= 20160, sum sells = 22

 

id_productaccumulate_minutessum_sells
11008010
12016022

 

Ashish_Mathur
Super User
Super User

Hi,

Clearly show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

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.