This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
Hi,
I need help with this measure:
Create a measure that sums the total cumulative sales of all customers who had no sales last year.
For this table, customers A and C had no sales last year, so the measure should result in 1699.66 (1539.24 + 160.42).
Thanks
Solved! Go to Solution.
You need to also filter out the rows where sales is 0
Cumulative Sales No Sales Last Year] =
VAR AllCustomers =
CALCULATETABLE ( DISTINCT ( 'Table'[Customer] ), REMOVEFILTERS () )
VAR PrevYear =
YEAR ( TODAY () ) - 1
VAR CustomersWithSalesLastYear =
CALCULATETABLE ( DISTINCT ( 'Table'[Customer] ), 'Table'[Year] = PrevYear, 'Table'[Sales] > 0 )
VAR CustomersNoSalesLastYear =
EXCEPT ( AllCustomers, CustomersWithSalesLastYear )
VAR Result =
CALCULATE ( SUM ( 'Table'[Sales] ), CustomersNoSalesLastYear )
RETURN
Result
You can try
Cumulative Sales No Sales Last Year =
VAR AllCustomers =
CALCULATETABLE ( DISTINCT ( 'Table'[Customer] ), REMOVEFILTERS () )
VAR PrevYear =
YEAR ( TODAY () ) - 1
VAR CustomersWithSalesLastYear =
CALCULATETABLE ( DISTINCT ( 'Table'[Customer] ), 'Table'[Year] = PrevYear )
VAR CustomersNoSalesLastYear =
EXCEPT ( AllCustomers, CustomersWithSalesLastYear )
VAR Result =
CALCULATE ( SUM ( 'Table'[Sales] ), CustomersNoSalesLastYear )
RETURN
Result
the measure should result in 1699.66 (1539.24 + 160.42).
You need to also filter out the rows where sales is 0
Cumulative Sales No Sales Last Year] =
VAR AllCustomers =
CALCULATETABLE ( DISTINCT ( 'Table'[Customer] ), REMOVEFILTERS () )
VAR PrevYear =
YEAR ( TODAY () ) - 1
VAR CustomersWithSalesLastYear =
CALCULATETABLE ( DISTINCT ( 'Table'[Customer] ), 'Table'[Year] = PrevYear, 'Table'[Sales] > 0 )
VAR CustomersNoSalesLastYear =
EXCEPT ( AllCustomers, CustomersWithSalesLastYear )
VAR Result =
CALCULATE ( SUM ( 'Table'[Sales] ), CustomersNoSalesLastYear )
RETURN
Result
@GFire Create a calculated column to check if a customer had sales last year:
DAX
HadSalesLastYear =
VAR CurrentYear = 'Table'[Year]
VAR Customer = 'Table'[Customer]
VAR SalesLastYear =
CALCULATE(
SUM('Table'[totalSales]),
FILTER(
'Table',
'Table'[Customer] = Customer &&
'Table'[Year] = CurrentYear - 1
)
)
RETURN
IF(SalesLastYear > 0, 1, 0)
Create a measure to sum the total sales for customers who had no sales last year:
DAX
TotalCumulativeSalesNoSalesLastYear =
CALCULATE(
SUM('Table'[totalSales]),
FILTER(
'Table',
'Table'[HadSalesLastYear] = 0
)
)
Proud to be a Super User! |
|
the measure should result in 1699.66 (1539.24 + 160.42).
Check out the May 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 27 | |
| 26 | |
| 22 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 42 | |
| 42 | |
| 41 | |
| 21 | |
| 20 |