Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
hello everyone, i have a table,
"transaction table"
i made a table visual that has transaction date and nb of transactions made
as a filter slicer, i have userID
here is an example
i need to add a new measure that will calculate the dattdif between each row of date
so for first row 0 becasue there is no previous date
then from first row to second row
there is 30 days almost so 30 days
then between second row and third row there is a diff of 1 day
..
after that i need to find the average so i can know how much this customer returns on average
So if we only take the first 2 calcultaions
30 + 1 = 31/2 = 15 days average
Solved! Go to Solution.
hi, @eliasayyy
try below
Measure 16 =
var a = ADDCOLUMNS(
ALL('transaction table'[transaction date],'transaction table'[transaction],'transaction table'[userid]),
"datediff",
var a = 'transaction table'[transaction date]
var b =
MINX(
FILTER(
'transaction table',
'transaction table'[userid]=EARLIER('transaction table'[userid]) &&
'transaction table'[transaction date]>a
),
'transaction table'[transaction date]
)
var c= IF(b=BLANK(),a,b)
RETURN
DATEDIFF('transaction table'[transaction date],c,DAY)
)
RETURN
AVERAGEX(FILTER(a,'transaction table'[transaction date]<=MAX('transaction table'[transaction date])),[datediff])
hi, @eliasayyy
try below
Measure 16 =
var a = ADDCOLUMNS(
ALL('transaction table'[transaction date],'transaction table'[transaction],'transaction table'[userid]),
"datediff",
var a = 'transaction table'[transaction date]
var b =
MINX(
FILTER(
'transaction table',
'transaction table'[userid]=EARLIER('transaction table'[userid]) &&
'transaction table'[transaction date]>a
),
'transaction table'[transaction date]
)
var c= IF(b=BLANK(),a,b)
RETURN
DATEDIFF('transaction table'[transaction date],c,DAY)
)
RETURN
AVERAGEX(FILTER(a,'transaction table'[transaction date]<=MAX('transaction table'[transaction date])),[datediff])
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
17 | |
10 | |
10 | |
8 | |
6 |
User | Count |
---|---|
18 | |
16 | |
15 | |
12 | |
10 |