Join 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!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hello,
I have a table (Invoice) that has customer account number (customerAccountNumber), invoice total (TotalAmountBase) and date of purchase (InvoiceDate). I am trying to calculate a few columns to ultimately come up with a distinct count of customers and revenue that have purchased in the past R12 months and also in the R24-R12 month time period. I want this to dynamically change with the date. This is what I have:
R12DistinctCustomer =
Solved! Go to Solution.
I was able to manage two new measures that compute R12 revenue and Previous R12 revenue. I then added the following measure to compute the total if a customer purchased in R12 and in Previous R12 time period. The new measure will return a zero if they did not purchase in BOTH timeframes. Just in case someone is looking to do the same.
R12ANDPRIORR12REVENUE =
@DylanJohanssen , better to create measure in such case
Rolling 12 Sales =
var _max = maxx(allselcted(date),date[date]) // or today()
var _min = date(year(_max), month(_max)-12,1)
return
CALCULATE(SUM(Sales[Sales Amount]),filter(date, date[date] <=_max && date[date] >=_min))
Rolling 12 before 12 Sales =
var _max1 = maxx(allselcted(date),date[date]) // or today()
var _max = date(year(_max1), month(_max1)-12,1)
var _min = date(year(_max), month(_max)-12,1)
return
CALCULATE(SUM(Sales[Sales Amount]),filter(date, date[date] <=_max && date[date] >=_min))
For the new column, you can sum up the data will add for 12 month in each row
Rolling 12 Sales column =
var _max =[date]
var _min = date(year(_max), month(_max)-12,1)
return
CALCULATE(SUM(Sales[Sales Amount]),filter(date, date[date] <=_max && date[date] >=_min))
Rolling 12 before 12 Sales column =
var _max1 = [Date]
var _max = date(year(_max1), month(_max1)-12,1)
var _min = date(year(_max), month(_max)-12,1)
return
CALCULATE(SUM(Sales[Sales Amount]),filter(date, date[date] <=_max && date[date] >=_min))
I was able to manage two new measures that compute R12 revenue and Previous R12 revenue. I then added the following measure to compute the total if a customer purchased in R12 and in Previous R12 time period. The new measure will return a zero if they did not purchase in BOTH timeframes. Just in case someone is looking to do the same.
R12ANDPRIORR12REVENUE =
User | Count |
---|---|
15 | |
11 | |
6 | |
6 | |
5 |
User | Count |
---|---|
30 | |
18 | |
11 | |
7 | |
5 |