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
Anonymous
Not applicable

calculate number of customer based on number of orders

Hi, 

My task is to Calculate Total of customers whom: 

made orders 1-5 

made orders 6-10 

made orders 11+

 

The result that I expected to see how many customer whom made 1-5 orders, 6-10, 10+ of each month

This is the result that I expect. I made it in Tableau. 

expect result.PNG

here is the file for you to have better understanding. 

https://we.tl/t-3SjZ91cTEM

Could you show me which calculation formula should I use to segment customer like this?

Data I use is: sample_superstore

Hope to hear from you and Thank you for reading!! 

9 REPLIES 9
DouweMeer
Post Prodigy
Post Prodigy

I think the easiest way is to create a table with date periods as input

Name   Start count   End count

M1        1                   5

M2        6                   10

Then create a table reference that has as output something like :

Cust 1 - PO5 

Cust 2 - PO6 

Cust 3 - PO7 

Cust 1 - PO 8 

Then create a new VAR with as table reference the previous created table. Add a column with count PO for cust:

Cust 1 - PO5 - Count 2

Cust 2 - PO6 - Count 1

Cust 3 - PO7 - Count 1

Cust 1 - PO8 - Count 2

Then it would be a 'simple' distinct selectcolumn on Cust with a filter similar to the set date periods. It will take you some time probably, but it would be a solution to your problem.

Anonymous
Not applicable

Hi, 

Thank you for your reply, 

Could you make it in a workbook and send it to me? 

cause it is quite vague for me to imagine.

 

 

All filesharing possibilities that go outside the company is limited thus I wouldn't be able to share it with you. Let me see if I can create an expression as example...

Anonymous
Not applicable

You can share it when you back home. 

I am using dta: sample_superstore

Hmm, stuffing it in a measure is the better solution. I've tested the measure for multiple months and it seems to be working. Still, the intermediate table references mentioned are still there.

 

M1 =
VAR a1 = 1
VAR a2 = 5
VAR t1 =
SELECTCOLUMNS(
    'PO table'
    , "Cust" , 'PO table'[Customer]
    )
VAR t2 =
distinct (
    SELECTCOLUMNS(
        t1
        , "Cust2" , [Cust]
        , "Count2" , countx ( filter ( 'PO table' , 'PO table'[Customer] = [Cust] ) , 'PO table'[Customer] )
        )
    )
RETURN
countx (
    filter (
        t2
       , [Count2] >= a1 && [Count2] <= a2
       ) 
    , [Cust2]
    )
 
Table with measureTable with measureThe measureThe measureThe 'PO Table'The 'PO Table'Intermediate result of the measureIntermediate result of the measure
Anonymous
Not applicable

Hi, 

Thank you for spending time to help me!

if you got the workbook that is much better for me. 

Cause seeing from the work that you do, I wonder what is PO?

As mentioned, Power BI doesn't support other file type to be uploaded than photos and videos, so I can understand your wish but I can't execute it :).

PO would be the abbreviation of Purchase Order. 

Anonymous
Not applicable

How about Cust1 , Cust2? How could I able to substitute. 

In my case, I calculate by Customer ID. 

The Cust should be the Customer ID :).

I wasn't able to download your pbix due to the IT settings over here.

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.