Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
MCLR
New Member

Calculating the time lapsed between latest transaction and the previous transaction

Can any one help me, please, to identify which accounts have started trading again, after a >12-month period  of inactivity? We want to reward our sales team not just for new accounts, but also for re-engaging with existing ones.

1 ACCEPTED SOLUTION

Actually, I think I am getting there with this:

 

Weeks Between Transactions =
VAR ThisTranDate =
SELECTEDVALUE ( 'PowerBi_Sales_Info'[InvoiceCreditDate] )
VAR PrevDate =
CALCULATE (
MAX ( 'PowerBi_Sales_Info'[InvoiceCreditDate] ),
FILTER ( ALL ( 'PowerBi_Sales_Info'[InvoiceCreditDate] ), 'PowerBi_Sales_Info'[InvoiceCreditDate] < ThisTranDate )
)
RETURN
DATEDIFF ( PrevDate, ThisTranDate, DAY ) / 7
 
This gives me the weeks between transactions; now I think I just need to filter out the old transactions

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Would be great if you can post some sample data along with the expected result.

Actually, I think I am getting there with this:

 

Weeks Between Transactions =
VAR ThisTranDate =
SELECTEDVALUE ( 'PowerBi_Sales_Info'[InvoiceCreditDate] )
VAR PrevDate =
CALCULATE (
MAX ( 'PowerBi_Sales_Info'[InvoiceCreditDate] ),
FILTER ( ALL ( 'PowerBi_Sales_Info'[InvoiceCreditDate] ), 'PowerBi_Sales_Info'[InvoiceCreditDate] < ThisTranDate )
)
RETURN
DATEDIFF ( PrevDate, ThisTranDate, DAY ) / 7
 
This gives me the weeks between transactions; now I think I just need to filter out the old transactions
Anonymous
Not applicable

Glad that you are able to do it on your own! Kudos to you.

 

Thanks
Raj

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.