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

How can I calculate the Number of client who ordered more than 1000 times last week?

Hello there,
I am having hard time to configure the number of clients who ordered more than certain number of times (1000 in my case). I have a client column and date table. The total order would be calculated by counting rows. Can some one help me please?

 

1 ACCEPTED SOLUTION

Try this measure :
Measure = COUNTROWS (
FILTER (
VALUES ( OrderTable[Client] ),
CALCULATE (
COUNTROWS ( OrderTable ),
ALLEXCEPT ( OrderTable, OrderTable[Client], OrderTable[OrderDate]),
DATESBETWEEN(OrderTable[OrderDate],TODAY()-7, TODAY())) >10000
)

)
Amira Bedhiafi
Full Stack Business Intelligence Consultant @Capgemini

View solution in original post

17 REPLIES 17
speedramps
Super User
Super User

amirabedhiafi

 

I think your solution counts orders.  When Kira_Net wants the number of clients with > 1000 orders.   😀

If you pick up a table visual with the Client and the measure it will give you the number of orders by client.

Adding a filter on the visual to display only the clients with more 1000 orders for the last week will give the expected result based on what the user defined in the begining.

Now the user @Kira_Net  in his last comment is giving another need which is a card with a specific calculation.

@Kira_Net  can you provide exactly the expected visual output ?

@speedramps  without input and expected output, I am a little bit lost...

Amira Bedhiafi
Full Stack Business Intelligence Consultant @Capgemini

I need the number of clients who ordered greater than 1000 times in last week. the expectedout put will be a scalar value.

@amirabedhiafi @speedramps 

 

speedramps
Super User
Super User

Hi again Kira_Net

 

 * Try use this measure with a filter on the visual for the current week or month, not all months *

 

I've helped you so please help me.

Please click the thumbs up and Accept As Solution to leave kudos.

 

Number of big clients =

// get a summary list of all clients and number of sales
VAR allcustomers =
SUMMARIZECOLUMNS(
Sales[Client],
"Volume",
COUNTROWS(Sales)
)
 
// reduce the summary to just clients with > 1000 sales
VAR bigclients = FILTER(allcustomers,[Volume] > 1000)

RETURN
// count the number of clients on the list
COUNTROWS(bigclients)
Kira_Net
Helper I
Helper I

Hmmm, But I wanted to display in a score card and I wanted a dax formula. I found this formula 
COUNTROWS(FILTER(SUMMARIZE('ORDER_TABLE', 'ORDER_TABLE[Client], "Count", Distinctcount(ORDER_TABLE[OrderID])),[Count]>1000))

But this doesn't give me the value for last week.

Try this measure :
Measure = COUNTROWS (
FILTER (
VALUES ( OrderTable[Client] ),
CALCULATE (
COUNTROWS ( OrderTable ),
ALLEXCEPT ( OrderTable, OrderTable[Client], OrderTable[OrderDate]),
DATESBETWEEN(OrderTable[OrderDate],TODAY()-7, TODAY())) >10000
)

)
Amira Bedhiafi
Full Stack Business Intelligence Consultant @Capgemini

@amirabedhiafi What do I do to add those volumes? Lets say we have 3 clients who ordered morethan 1000 according to this dax formula, and I want to add those volume. Please.

 

 

It is simple try to SUM the quantity like below : 

CalculateVolume = SUM(OrderTable[Volume])

and put it in a card near to the other one, it will only show the volume count for the clients who ordered more than 10000

Amira Bedhiafi
Full Stack Business Intelligence Consultant @Capgemini

@amirabedhiafi I want to sum the order value for those who ordered greater than 1000 only.

 

What do you mean by volume? is it the quantity ordered by each client ?

Amira Bedhiafi
Full Stack Business Intelligence Consultant @Capgemini

Thank you! This works perfectly.

Glad to help! Keep up the good work

Amira Bedhiafi
Full Stack Business Intelligence Consultant @Capgemini
speedramps
Super User
Super User

Hi Kira_Net

Try use this measure with a filter for the current week.

I've helped you so please help me.

Please click the thumbs up and Accept As Solution to leave kudos.

 

Number of big clients =

// get a summary list of all clients and number of sales
VAR allcustomers =
SUMMARIZECOLUMNS(
Sales[Client],
"Volume",
COUNTROWS(Sales)
)
 
// reduce the summary to just clients with > 1000 sales
VAR bigclients = FILTER(allcustomers,[Volume] > 1000)

RETURN
// count thw number of clients on the list
COUNTROWS(bigclients)

@speedramps Thank you, but this only gives me the value for all time. I want to return only last week(weekly) and last month (last Month). Can you help me with that?

 

Kira_Net
Helper I
Helper I

@amirabedhiafi  Sure, my data looks like this.

Kira_Net_0-1651503482138.png

 

Create a measure where you retrieve the count for all the clients starting from last week until today : 

Count of Orders = CALCULATE(COUNT(OrderTable[Client]),DATESBETWEEN(OrderTable[OrderDate],TODAY()-7, TODAY())
)
then in the visual you can apply a condition on the measure above, is greater than or equal 1000 like below : 
amirabedhiafi_0-1651511272393.png

 

 

Amira Bedhiafi
Full Stack Business Intelligence Consultant @Capgemini
amirabedhiafi
Impactful Individual
Impactful Individual

Can you share sample of the data you are working on with the needed columns ?

Amira Bedhiafi
Full Stack Business Intelligence Consultant @Capgemini

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.