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
natabird3
Continued Contributor
Continued Contributor

Countif of a measure rather than a calculated column

Hello,

 

I have seen a lot of posts on this, however all are about creating a calculated column, which i dont think can work in my case.

I have two measures:

 
First one calculating the number of weekly sales
Count of sales per week =CALCULATE(COUNTA('Sales'[Sale]), 'Sales Discount'[N/P+P/P+S/P] IN { "Promo", "No Promo", "Some Promo"})/DISTINCTCOUNT('Calendar'[weekday])
 
Then the second one, calculating the percent from promo and some promo vs normal
promoted sales percentage = DIVIDE([Count of all sales],[Count of sales per week])
 
Then what i would like to get is this:
performance = if(AND([Count of sales per week]>1,[promoted sales percentage]>0.8),1,0)
 
Which works great when comparing to each store in each country, however how can i get a total sum value of this, meaning the total of all the stores that meet this criteria in performance measure? 
 
Hope you can help, thanks in advance and stay safe. 
1 ACCEPTED SOLUTION
V-pazhen-msft
Community Support
Community Support

@natabird3 

 

Try something like this:

 

 

Measure = sumx(filter(sales,AND([Count of sales per week]>1 ,[promoted sales percentage]>0.8)),performance )

 

 

 

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

View solution in original post

3 REPLIES 3
V-pazhen-msft
Community Support
Community Support

@natabird3 

 

Try something like this:

 

 

Measure = sumx(filter(sales,AND([Count of sales per week]>1 ,[promoted sales percentage]>0.8)),performance )

 

 

 

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

amitchandak
Super User
Super User

@natabird3 , Try like

calculate(sum(sales[sales]) filter(sales,AND([Count of sales per week]>1 ,[promoted sales percentage]>0.8)))

Unfortunately, this is giving me the sum of the sales, while what i need is the sum of the count. So for instance i have 10 stores, 2 of them were meeting the set criteria for sales per week and promoted sales %, so i would like to get the number 2 as the output of my measure. Hope this makes sense, tahnsk for the quick reply.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.