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

Don'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.

Reply
YcnanPowerBI
Helper II
Helper II

Dividing 2 measure with a greater than

Hello 

 

I have two measures:

 

  1.  counting orders by customer
    1. _Order Counts = CALCULATE(DISTINCTCOUNT(Merge3[orderId]), ALLEXCEPT(Merge3, Merge3[customerId]))
       
  2. Count of total distinct customers
    1. _Total Distinct Customers = DISTINCTCOUNT(Merge3[customerId])

I am trying to divide the number of customers with an order count greater than 1 by my total distinct customers to get a repeat customer rate.  

 

Nothing I am try is working 😞

 

1 ACCEPTED SOLUTION

Hi,

I realized I made a mistake in my first measure. Please re-write it as below:

_Repeat Counts = COUNTROWS(
    FILTER(SUMMARIZE(
        'Table','Table'[CustomerID],"Over2",COUNT('Table'[OrderID])),[Over2]>1))

 

I'm sure this will solve the problem. I tested it with some mock data (see below):
Dividing 2 measures.jpg



If the post helped then please give it a Kudos and mark it as the solution so others can see it.
Cheers,

View solution in original post

8 REPLIES 8
MNedix
Super User
Super User

Hi,

I would re-write the 1st measure like this:

_Orders_over_1 = CALCULATE(
    DISTINCTCOUNT(Merge3[customerId]),FILTER(Merge3,COUNT(Merge3[orderId]>1))

This should give you the Customers with more than 1 Order. The 2nd measure should be fine.

Then you can do the last measure:

_Repeat_Customer_Rate = DIVIDE(_Orders_over_1,_Total Distinct Customers,BLANK())

 

If this solved your problem then please mark it as the solution so others can see it.



If the post helped then please give it a Kudos and mark it as the solution so others can see it.
Cheers,

I am receiving the error below and am not sure why

 

Nresendes_0-1711998303311.png

 

Since you didn't provide any data I can't really debug it to see what's wrong. Try creating a measure as below, put it in a card visual and see if you get the same.

Temp_measure = calculate(count([orderID]))

 



If the post helped then please give it a Kudos and mark it as the solution so others can see it.
Cheers,

My apologies, sample data below.  I did not get the same error, and it matches a prior measure I had for order count.

Nresendes_0-1711999673385.png

Here is a link to sample data.  I have never tried sending a link, so please let me know if this does not work.  

Orders Sample Data

 

 

 

 

 

Unfortunately the link doesn't work, so you'll have to use Dropbox or other sharing clouds. However, since you have all columns in the same table, you could re-write the measure as:

_Repeat Counts = CALCULATE(
    DISTINCTCOUNT(Merge3[customerId]),FILTER(Merge3,COUNT([orderId]>1)))

 



If the post helped then please give it a Kudos and mark it as the solution so others can see it.
Cheers,

Well this is destined not to work for me for some reason, this one is giving me the same error.  I am including a data screenshot, but I also created a copy in my google drive to see if that link works.  I truly appreciate the time you have already spent on this!  

 

https://drive.google.com/file/d/1wLaBx8JsAL-4P3E-b4VVsLzZVUkU3L5L/view?usp=drive_link

Nresendes_0-1712004608867.png

 

Hi,

I realized I made a mistake in my first measure. Please re-write it as below:

_Repeat Counts = COUNTROWS(
    FILTER(SUMMARIZE(
        'Table','Table'[CustomerID],"Over2",COUNT('Table'[OrderID])),[Over2]>1))

 

I'm sure this will solve the problem. I tested it with some mock data (see below):
Dividing 2 measures.jpg



If the post helped then please give it a Kudos and mark it as the solution so others can see it.
Cheers,

Thank you so much for all of your help!  It worked!  

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! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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