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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
VuongLM93
Helper III
Helper III

Sum sales by customers with individual Start - End Date

I have a few tables:

1.  Dim - Customers  ( with start - end date) 

CustomerCodeCustomerNameStart DateEnd Date
C001A1-1-202130-1-2022
C002B1-10-202031-10-2022
C003C1-10-202031-10-2022
C00N

D

31-10-2022

31-10-2022

2.  Fact - Volume  quantity

 

CustomerCodeSKUVolume quantityDate invoice  
C001SKU 1101-1-2021  
C001SKU 2201-1-2021  
.......30   
C00N

SKU 2

40

 

 

 

 

How to sum the volume for each Customer Code within their respective Start -End date? 

 

CustomerCodeCustomerNameStart DateEnd DateTotal volume within period
C001A1-1-202130-1-2022?
C002B1-10-202031-10-2022 
C003C1-10-202031-10-2022 
C00N

D

31-10-2022

31-10-2022

 

]

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @VuongLM93 

I created a measure that may meet your needs .

Total volume within period

= CALCULATE(SUM('Fact - Volume  quantity'[Volume quantity]),

FILTER('Fact - Volume  quantity','Fact - Volume  quantity'[CustomerCode]=MAX('Dim - Customers'[CustomerCode])

                                                    && 'Fact - Volume  quantity'[Date invoice]>=MAX('Dim - Customers'[Start Date])

                                                     && 'Fact - Volume  quantity'[Date invoice]<=MAX('Dim - Customers'[End Date])))

 

The quantity within the period will be summed.

The effect is as shown:

Ailsa-msft_0-1617257470800.png

Ailsa-msft_1-1617257470801.png

Ailsa-msft_2-1617257470803.png

Best Regards

Community Support Team _ Ailsa Tao

 

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

4 REPLIES 4
Anonymous
Not applicable

Hi @VuongLM93 

I created a measure that may meet your needs .

Total volume within period

= CALCULATE(SUM('Fact - Volume  quantity'[Volume quantity]),

FILTER('Fact - Volume  quantity','Fact - Volume  quantity'[CustomerCode]=MAX('Dim - Customers'[CustomerCode])

                                                    && 'Fact - Volume  quantity'[Date invoice]>=MAX('Dim - Customers'[Start Date])

                                                     && 'Fact - Volume  quantity'[Date invoice]<=MAX('Dim - Customers'[End Date])))

 

The quantity within the period will be summed.

The effect is as shown:

Ailsa-msft_0-1617257470800.png

Ailsa-msft_1-1617257470801.png

Ailsa-msft_2-1617257470803.png

Best Regards

Community Support Team _ Ailsa Tao

 

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

amitchandak
Super User
Super User

@VuongLM93 , A new column in the customer table


sumx(filter(Volume, Volume[Date invoice] >= Customers[Start Date] && Volume[Date invoice] <= Customers[End Date] && Volume[CustomerCode] = Customers[CustomerCode]),Volume[Volume])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks @amitchandak  ,

Unfortunately I cannot create Customer Column due to it being a live dataset,

IS there a way to create a Measure instead?

@VuongLM93 , Try a measure like

calculate(sumx(values(Volume[CustomerCode]),Volume[Volume]),filter(Volume, Volume[Date invoice] >= min(Customers[Start Date]) && Volume[Date invoice] <= max(Customers[End Date]) && Volume[CustomerCode] = max(Customers[CustomerCode])))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
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.