Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. 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]
)
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
9 | |
7 | |
6 | |
5 |
User | Count |
---|---|
20 | |
11 | |
10 | |
9 | |
6 |