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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
735Alka
Frequent Visitor

I need to count the users whose average sale has been greater than or equal to 50 in past 3 months

Dear Community Users ,

I have sales data which having columns date,user code,approval status,sales quantity. final sales quantity will be considered when approval status="Approved"

I need to count the users whose average sale has been greater than or equal to 50 in the past three months

For an example, if a user sold in 3 months, the average will be the sum of sales in 3 months divided by 3, and so on for 2 and 1 months. 

 

Please help me with this

Thanks

2 ACCEPTED SOLUTIONS

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1714547079693.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

Hi,

PBI file attached.

Ashish_Mathur_0-1714866311792.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

8 REPLIES 8
Ashish_Mathur
Super User
Super User

Hi,

Share some data to work with and show the expected result clearly.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi, here is my sample data 

StatusDateUser CodeSales Quantity
Approved27-02-20244313150
Approved21-03-20244313150
Approved02-02-20244313050
Approved27-03-20244313060
Approved27-03-20244313060
Approved01-01-2024431301
Approved18-03-2024431308
Approved09-01-202443131150
Approved02-02-202443130150
Approved27-01-20244313072
NA12-02-202443131180
NA07-01-20244313198
Approved05-03-20244313070
Approved27-02-20244313090
Approved06-02-20244313050
NA06-12-202370313100
Rejected21-02-20244313030
NA07-01-202443131100
NA12-02-202443131170
Approved09-03-202433313201
Approved26-02-202433313200
Approved09-01-20244313150
Approved21-03-202443131100
Approved04-12-20234313012
Approved18-03-202443130130
Approved01-01-20244313070
Approved17-01-20244313080
Approved22-12-20234313040
Approved08-12-20234313050
Approved23-03-20244313080
Approved19-02-202443130170
Approved14-02-202443130120
Approved23-03-20244313080
Approved14-02-202443130120
Approved04-12-202343130180
Approved05-02-202443130100
Approved07-02-20243331365
Approved10-01-202443130180
Approved19-12-202343130110
Approved25-01-202433313185
Rejected09-12-20233331360
NA17-02-202443131180
NA31-03-202470313100
NA31-03-202470313100
NA30-03-202470313100
NA28-03-202470313100
NA24-03-20247031385
NA16-03-20247031380
NA15-03-202470313100
NA14-03-20247031375
NA06-01-202433313150
NA02-02-202433313130
NA18-03-202433313135
NA02-02-202433313125
NA07-01-202443131125
Approved11-03-20244313151
Approved19-12-20234313124
Approved19-12-20234313119
Approved11-01-20244313150
Approved11-03-202443131150
Approved14-02-20244313130
Approved28-12-20234313180
Approved12-02-202443131190
Approved31-12-20237031325
Approved30-03-20247031320
Approved31-01-20247031320
Approved04-12-20234313080
Approved06-12-2023431305
Approved01-01-20244313080
Approved17-01-20244313040
Approved31-01-202443130200
Approved09-03-202443130200
Approved18-03-20244313051
Approved11-12-202343130150
Approved11-12-202343130200
Approved11-12-202343130200
Approved11-12-202343130200
Approved24-01-202433313200
Approved24-01-20243331326
Approved24-12-202333313200


and my output number will be 3 which has average greater than or equal to 50

user codeJanFebmarchaveragecount
333134112652012921
431307238507397711
431312502703512901
7031320 20200

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1714547079693.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur 
Here , The condition I have is slightly different; I need to determine the number of users and their volume  whose last 3 month average sale greater than or equal to 50.
for which i have created some measure for the count of users and their volume as well
Now, the measure for the no. of users is giving correct value but their volume is not correct value and i need volume is CARD Visual
i have attached a link in which i have attached file and excel working sheet which is my final users and their volume 
 Thanks

https://drive.google.com/file/d/1w8cA2yDBiJEGMKJIYbgRUKIbam-WFviy/view?usp=drive_link 

Hi,

PBI file attached.

Ashish_Mathur_0-1714866311792.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hii @Ashish_Mathur 
Thanks ,the solution you provided is working fine, but now I need to find the average volume of those customers whose sale is >=50, for which I am using this dax, but it is not giving me the correct value
volume=calculate(Average monthly sale for 3 months ended,
filter(
summarize(data,data[user code],[Measure]))
Here ,Measure is the no. of users whose sale is>=50
and when using this dax ,it is skipping the volume of users which sale is not in current selected month while have sale in last 2 months

L3M AVG>=50 VOLUME = CALCULATE(Average monthly sale for 3 months ended ,
    FILTER(
    SUMMARIZE(data,data[User Code],"sum qty",[Flag]),[Flag]=1))

Please help 
Thanks




That figure is already present in the file which i shared with you earlier - 1336.67.  If that is not the figure you want, then show the expected result  with your Excel workings.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-kaiyue-msft
Community Support
Community Support

Hi @735Alka ,

 

Based on your description, I created this data.

vkaiyuemsft_0-1714529870444.png


1. Create a measure to obtain the user's average sales.

Measure =
VAR _min_date = CALCULATE(MIN('Table'[date]),FILTER(ALL('Table'),'Table'[user code] = MAX('Table'[user code])))
VAR _max_date = CALCULATE(MAX('Table'[date]),FILTER(ALL('Table'),'Table'[user code] = MAX('Table'[user code])))
VAR _diff = DATEDIFF(_min_date,_max_date,MONTH) + 1
VAR _sum = CALCULATE(SUM('Table'[sales quantity]),FILTER(ALL('Table'),'Table'[user code] = MAX('Table'[user code]) && 'Table'[approval status ] = "Approved"))
VAR _result = DIVIDE(_sum,_diff)
RETURN
_result


2. Create a measure and mark results greater than 50.

Measure 2 =
IF('Table'[Measure] >= 50,1,0)

 

3. Use measure 2 as a filter for visual objects, and the results obtained are as shown in the figure below.

vkaiyuemsft_1-1714529923765.png

 

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.