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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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.



Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

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.



Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.