Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
Hi,
I am trying to make a summarize table (summarizing customers number of orders and total value of those orders) and then would like to refer to it in SUM function to sum sales only those customers who have number of orders less or equal 3. The below code returns total sales of all customers - like a filter does not work. What am I doing wrong?
Solved! Go to Solution.
Hi,
Please try something like below whether it suits your requirement.
NewCustomersSales =
VAR CustomerOrders =
SUMMARIZE (
Orders,
Orders[CompanyName],
"OrdersCount", CALCULATE ( DISTINCTCOUNT ( Orders[OrderID] ) ),
"TotalSales", CALCULATE ( SUM ( Orders[Sales] ) )
)
RETURN
SUMX ( FILTER ( CustomerOrders, [OrdersCount] <= 3 ), [TotalSales] )
Hi,
Please try something like below whether it suits your requirement.
NewCustomersSales =
VAR CustomerOrders =
SUMMARIZE (
Orders,
Orders[CompanyName],
"OrdersCount", CALCULATE ( DISTINCTCOUNT ( Orders[OrderID] ) ),
"TotalSales", CALCULATE ( SUM ( Orders[Sales] ) )
)
RETURN
SUMX ( FILTER ( CustomerOrders, [OrdersCount] <= 3 ), [TotalSales] )
NewCustomersSales =
VAR CustomerOrders =
SUMMARIZE(
Orders,
[CompanyName],
"OrdersCount", DISTINCTCOUNT([OrderID]),
"TotalSales", SUM([Sales])
)
RETURN
SUMX(
FILTER(
CustomerOrders,
[OrdersCount] <= 3
),
[TotalSales]
)
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 3 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 13 | |
| 9 | |
| 8 | |
| 8 | |
| 7 |