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
Julier
Helper III
Helper III

SUMIFS

Hello, I am trying to use a sumifs to total up the sales between certain days a for a particular customer. my data has the day numbers acrross the top with the sales below and the customer name in column A, my tables then have the customer name and the breakdown of the days in weekly buckets, i have tried but i keep getting #Value error?

DAY NUMBERS0102030405060708091011121314151617181920212223
CUSTOMER A0 5  10    10 125      151617
CUSTOMER B 5 6       10  15 23     5   10  18 
CUSTOMER C 1 5  6       8 10 23    27  29   30 
                        
                        
CUSTOMER A                       
daysJANUARY                      
1 to 7                       
8 to 14                       
15 to 21                       
22 to 31                       
TOTAL ORDERS                       
                        
CUSTOMER B                       
Order/delivery patternJANUARY                      
1 to 7                       
8 to 14                       
15 to 21                       
22 to 31                       
1 ACCEPTED SOLUTION
Akash_Varuna
Super User
Super User

Hi @Julier  The SUMIFS formula returns a #VALUE! error due to the table layout with day numbers in columns.Please try these

  • Use Power Query to unpivot the day columns, transforming the data into a tabular format with columns for Customer, Day, and Sales.

  • Apply a conditional column or filter to select the desired day range.

  • Use a SUM measure in DAX:

Total Sales = CALCULATE(SUM(Sales[Value]), Sales[Day] >= 8, Sales[Day] <= 14, Sales[Customer] 

 

View solution in original post

8 REPLIES 8
v-sdhruv
Community Support
Community Support

Hi @Julier ,
I hope you were able to resolve the issue by the solution provided.
If it has answered your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
Thank you.

v-sdhruv
Community Support
Community Support

Hi @Julier ,
I hope you were able to resolve the issue by the solution provided.
If it has answered your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
Thank you.

v-sdhruv
Community Support
Community Support

Hi @Julier ,
I hope you were able to resolve the issue by the solution provided.
If it has answered your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
Thank you.

Akash_Varuna
Super User
Super User

Hi @Julier  The SUMIFS formula returns a #VALUE! error due to the table layout with day numbers in columns.Please try these

  • Use Power Query to unpivot the day columns, transforming the data into a tabular format with columns for Customer, Day, and Sales.

  • Apply a conditional column or filter to select the desired day range.

  • Use a SUM measure in DAX:

Total Sales = CALCULATE(SUM(Sales[Value]), Sales[Day] >= 8, Sales[Day] <= 14, Sales[Customer] 

 

bhanu_gautam
Super User
Super User

@Julier Create a table that contains the day numbers. This can be done in Power BI using the "Enter Data" feature or by creating a calculated table.

DateRange = GENERATESERIES(1, 31, 1)

 

Create a table that contains the unique customer names. This can be done using the "Enter Data" feature or by creating a calculated table.

CustomerTable = DISTINCT('Sales'[Customer])

 

Add slicers to your report for selecting the customer and the date range. Use the CustomerTable for the customer slicer and the DateRange for the date range slicer.

 

Use DAX to create a measure that dynamically calculates the sales based on the selected customer and date range

DAX
DynamicSales =
VAR SelectedCustomer = SELECTEDVALUE('CustomerTable'[Customer])
VAR StartDay = MIN('DateRange'[Value])
VAR EndDay = MAX('DateRange'[Value])
RETURN
CALCULATE(
SUM('Sales'[Sales]),
'Sales'[Customer] = SelectedCustomer,
'Sales'[Day] >= StartDay,
'Sales'[Day] <= EndDay
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Thank you for you quick response, however i need to do this in excel

 

@Julier , Try using

excel
=SUMIFS(B2:X2, $A$2:$A$4, "CUSTOMER A", $B$1:$X$1, ">=1", $B$1:$X$1, "<=7")

 

=SUMIFS(B3:X3, $A$2:$A$4, "CUSTOMER B", $B$1:$X$1, ">=8", $B$1:$X$1, "<=14")




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Hi @Julier If this is in excel use SUMPRODUCT please 

=SUMPRODUCT(($A$2:$A$4="Customer A")*(B$1:Z$1>=8)*(B$1:Z$1<=14)*(B2:Z4))

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.