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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
laba031095
Frequent Visitor

Need calculate number with two conditions

I have table:
tabletable








There was a need to count the number of stores under two conditions.
1) There are 2/3/4 necessary SKUs in the store
2) The amount of sales in the store is more than $30

for example, I need to find a store that sells $30 or more and has SKU1 and SKU2

In this case, the answer will be "3"

If you need to find a store that sells in the amount of $ 30, and where there are SKU1 and SKU4, the answer will be "1"





1 ACCEPTED SOLUTION

Hi @laba031095 ,

 

Try to create a measure like below:

Measure 2 = 
var count_1 =  COUNTROWS(FILTER('Table','Table'[SKU] in VALUES('Table 2'[SKU])))
var count_2 = COUNTROWS('Table 2')
var sum_ = CALCULATE(SUM('Table'[Sum]),ALLEXCEPT('Table','Table'[Shop]))
return if(count_1=count_2,CALCULATE(DISTINCTCOUNT('Table'[Shop]),FILTER('Table',sum_>=30)))

See if it will meet your needs

Vlianlmsft_0-1645509277150.pngVlianlmsft_1-1645509288891.png

 

 

Best Regards,
Liang
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
Pragati11
Super User
Super User

Hi @laba031095 ,

 

This is easily achievable. Can you share sample data by copying from excel and pasting it here?

you have shared a screenshot for which I will have to type the data to try at my end.

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

ShopSKUSum
Shop1Sku110
Shop1Sku215
Shop1Sku35
Shop2Sku110
Shop2Sku220
Shop3Sku15
Shop3Sku210
Shop3Sku35
Shop3Sku410

Hi @laba031095 ,

 

Try to create a measure like below:

Measure 2 = 
var count_1 =  COUNTROWS(FILTER('Table','Table'[SKU] in VALUES('Table 2'[SKU])))
var count_2 = COUNTROWS('Table 2')
var sum_ = CALCULATE(SUM('Table'[Sum]),ALLEXCEPT('Table','Table'[Shop]))
return if(count_1=count_2,CALCULATE(DISTINCTCOUNT('Table'[Shop]),FILTER('Table',sum_>=30)))

See if it will meet your needs

Vlianlmsft_0-1645509277150.pngVlianlmsft_1-1645509288891.png

 

 

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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.