Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
My source data has customer name and transaction date that I have linked to a traditional calendar table.
We are looking at this data by quarter.
I have a filter to select a quarter. I want a measure that looks at the prior year quarter and sums all the customers who had sales in that quarter but not the selected quarter.
So I have Q2 2022 selected. I want a measure that sums the sales amount from Q2 2021 for all the customers who had sales in Q2 2021 but no sales in Q2 2022. This is my attempt but it's not really working:
No Sales Reported in Selected Qtr = CALCULATE([Prior Year QTD $],FILTER(VALUES('Combined Data'[Customer]),'Combined Data'[Net Sales $]=BLANK()))
Solved! Go to Solution.
Hi @PowerUser123
Please try
No Sales Reported in Selected Qtr =
VAR CurrentYear =
YEAR ( MAX ( 'Date'[Date] ) )
VAR CurrentYearCustomers =
VALUES ( 'Combined Data'[Customer] )
VAR CurrentYearCustomers =
CALCULATETABLE (
VALUES ( 'Combined Data'[Customer] ),
'Date'[Year] = CurrentYear - 1
)
VAR ChurnedCustomers =
EXCEPT ( CurrentYearCustomers, CurrentYearCustomers )
RETURN
CALCULATE ( [Prior Year QTD $], ChurnedCustomers )
| Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
Hi @PowerUser123
Please try
No Sales Reported in Selected Qtr =
VAR CurrentYear =
YEAR ( MAX ( 'Date'[Date] ) )
VAR CurrentYearCustomers =
VALUES ( 'Combined Data'[Customer] )
VAR CurrentYearCustomers =
CALCULATETABLE (
VALUES ( 'Combined Data'[Customer] ),
'Date'[Year] = CurrentYear - 1
)
VAR ChurnedCustomers =
EXCEPT ( CurrentYearCustomers, CurrentYearCustomers )
RETURN
CALCULATE ( [Prior Year QTD $], ChurnedCustomers )
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 48 | |
| 45 | |
| 41 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 68 | |
| 68 | |
| 33 | |
| 31 | |
| 31 |