Calculate number of customer with special condition

Hi every body
I have a question

I have a sales table and two disconnected table
User Choose a number, an amount and a week

I want to write a measure that calculate Number of customer who bought at least #number and in each order at least #Amount in a specefic week or month or …

for example in this image user has selected week 5 , number 2 and 20000 amount
I want to calculate Count of customer Who bought at least 2 time and at least 20000$ in each order in week 5.
in this case hana and zaha are 2 customer that bought 2 time and in each order at least 20000$.
I want to claculate this number (2) and show this two customer name.
thanks for your consideration

Screenshot (19)

Hi @HosseinVossoughi, we aim to consistently improve the topics being posted on the forum to help you in getting a strong solution faster. While waiting for a response, here are some tips so you can get the most out of the forum and other Enterprise DNA resources.

  • Use the forum search to discover if your query has been asked before by another member.

  • When posting a topic with formula make sure that it is correctly formatted to preformatted text </>.

    image

  • Use the proper category that best describes your topic

  • Provide as much context to a question as possible.

  • Include the masked demo pbix file, images of the entire scenario you are dealing with, screenshot of the data model, details of how you want to visualize a result, and any other supporting links and details.

I also suggest that you check the forum guideline How To Use The Enterprise DNA Support Forum. Not adhering to it may sometimes cause delay in getting an answer.

Please also check the How To Mask Sensitive Data thread for some tips on how to mask your pbix file.

1 Like

@HosseinVossoughi

You can try this measure with CustomerName in a table.

Customer Sales =
VAR number =
SELECTEDVALUE ( N[Value], 4 )
VAR salesAmt =
SELECTEDVALUE ( ‘Sales Amt’[Value], 200 )
VAR tbl1 =
FILTER ( Orders , Orders[Sales] >= salesAmt )
VAR tbl2 =
SUMMARIZE (
tbl1,
Orders[Customer Name],
“Count”, CALCULATE ( COUNT ( Orders[Customer Name] ) )
)
VAR tbl3 =
FILTER ( tbl2, [Count] = number )
RETURN
CALCULATE ( SUM ( Orders[Sales] ), VALUES ( Orders[Customer Name] ), tbl3 )

Thanks

1 Like

Thanks @sparse-coder, But I want to know number of customer in a card and name of them in a table. for example in week 5 this measure should return 2 and name of these customers are hana and zaha.

Your Code seems right. Thanks for your response.