The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello, I'm look for some direction on a dax issue i'm having. I need to create a New Customer TTM (Trailing Twelve Month Measure) thats dynamic. New Customers are customers that exist within the last 12 months but not the 12 months before that. I went with a
calculated table method but i'm running into issues where the numbers are incorect on a line graph, i'm guess it's because theres no date table relationship with my calculated table. Any direction or help would be great. Below is what I have so far.
Thanks for simplifying it, I'm still running into the same date issue though. Let me know if you have any tips or solutions. This DAX might not even be the right solution, its just what came to mind.
Your date logic is fairly complicated. I think this might be a bit easier to debug:
New Customer TTM =
VAR CurrDate = MAX ( 'Date Table'[DateValue] )
VAR CustomerInvoiceCountbyBucket =
CALCULATETABLE (
ADDCOLUMNS (
VALUES ( 'P21&IBS Data'[CustomerID] ),
"lastYearInvoiceCount",
CALCULATE (
DISTINCTCOUNT ( 'P21&IBS Data'[InvoiceKey] ),
DATESINPERIOD ( 'Date Table'[DateValue], CurrDate, -1, YEAR )
),
"lastTwoInvoiceCount",
CALCULATE (
DISTINCTCOUNT ( 'P21&IBS Data'[InvoiceKey] ),
DATEADD (
DATESINPERIOD ( 'Date Table'[DateValue], CurrDate, -1, YEAR ),
-1,
YEAR
)
)
)
)
VAR newCustomers =
FILTER (
CustomerInvoiceCountbyBucket,
ISBLANK ( [lastTwoInvoiceCount] ) && [lastYearInvoiceCount] > 0
)
VAR Result = COUNTROWS ( newCustomers )
RETURN
Result
User | Count |
---|---|
12 | |
8 | |
6 | |
6 | |
6 |
User | Count |
---|---|
24 | |
14 | |
13 | |
9 | |
7 |