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
niko18033
Helper I
Helper I

Time Intelligence: Calculate order rate by month, for specific customers in succeeding 60 days

Hi PPI Experts!

 

I have a tricky Time Intelligence problem I'm stumped on. I'd like to calculate something let's call "order rate", which is the percent of all customers from a given month who make an order within 60 days of the month they signed up (enroll date) for the service.

 

Below is some sample data. Here's my issue. For the given enroll month, I want the numerator (# of Customers w/ Order) to be the # of customers from the enroll month who placed an order within 60 days of the day upon which they enrolled. Currently, it's just calculating the # of Customers who placed an order in the same month in which they enrolled. Rather, I'd like to find the # of Customers who placed an order within 60 days of their enroll date, but keep the 'axis' to the month which they enrolled.

 

For example, let's take the month beginning 5/1/2021. Of the 717 customers who enrolled in May 2021, I want to calculate how many of those particular 717 customers placed an order at any point within 60 days of their respective enroll date.

 

Enroll MonthOrder Rate# of Customers w/ Order within 60 days# of Customers
7/1/202033.33%26
8/1/202018.82%1685
9/1/202024.66%54219
10/1/202017.02%64376
11/1/202013.66%59432
12/1/20209.59%51532
1/1/202114.38%44306
2/1/20219.75%39400
3/1/20219.22%51553
4/1/20215.37%36670
5/1/20214.74%34717
6/1/20212.69%24891
7/1/20210.54%5930
8/1/20210.48%2414

 

Enroll Month is simply a monthly aggregate of the 'enroll day' field (new group of 'enroll day'). The raw data fields would be:

  • Enroll Day (data type: Date)
  • Customer ID (data type: Text)
  • Order ID (data type: Text)

Measures: 

  • # of Customers = DISTINCTCOUNT(Customer ID)
  • # of Customers w/ Order = CALCULATE(DISTINCTCOUNT(Customer ID), Order ID <> BLANK())

Please help me solve for the measure: # of Customers w/ Order within 60 days

 

Any assistance would be much appreciated! Please let me know if you need me to provide any further details. Thanks in advance!

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@niko18033 I feel like I am missing half the information needed to solve this like, is there a separate sales table that has the orders in it with the date they were ordered? But in general it should look something along the lines of:

Measure = 
  VAR __EnrollDate = MAX('Table'[Enroll Month])
  VAR __60DaysLater = (__EnrollDate + 60) * 1.
  VAR __Table = FILTER(ALL('Sales'),[Order Date] >= __EnrollDate && [Order Date]<=__60DaysLater)
RETURN
  COUNTROWS(DISTINCT(SELECTCOLUMNS(__Table,"CustomerID",[CustomerID])))

But again, this is a lot of speculation on my part. Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

1 REPLY 1
Greg_Deckler
Super User
Super User

@niko18033 I feel like I am missing half the information needed to solve this like, is there a separate sales table that has the orders in it with the date they were ordered? But in general it should look something along the lines of:

Measure = 
  VAR __EnrollDate = MAX('Table'[Enroll Month])
  VAR __60DaysLater = (__EnrollDate + 60) * 1.
  VAR __Table = FILTER(ALL('Sales'),[Order Date] >= __EnrollDate && [Order Date]<=__60DaysLater)
RETURN
  COUNTROWS(DISTINCT(SELECTCOLUMNS(__Table,"CustomerID",[CustomerID])))

But again, this is a lot of speculation on my part. Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.