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
BobbyBiff
New Member

Measure for Distinct Count of Product that have a total number of sales lower than a specific amount

I'm trying to come up with a measure that will count the number of low performing products (less than 10 total sales) each year.

 

In the example below, the products are separated by another field (gender), so the measure needs to sum the total but also do a distinct count of product.

 

ProductYearSalesGender
Apple201910Male
Apple20195Female
Banana201915Male
Banana20196Female
Orange20192Male
Orange20191Female
Apple20204Male
Apple20209Female
Banana20208Male
Banana20203Female
Orange20204Male
Orange20207Female
Apple20219Male
Apple20216Female
Banana20213Male
Banana20211Female
Orange20212Male
Orange20211Female

 

I can already use the existing table to produce this:

Product201920202021
Apple151315
Banana21114
Orange3113

 

The answer I'm looking for would allow me to produce a visualisation that returns something like this:

 

Year201920202021
Number of products with fewer than 10 sales10

2


My current efforts have hit a dead end at:

 

 

Measure = Calculate(distinctcount('Table'[Product],
FILTER(('Table'),
SUM('Table'[Sales])<10
))

 

 

As you can see i'm a bit of newbie with DAX so any help would be greatly appreciated!

1 ACCEPTED SOLUTION
Ahmedx
Super User
Super User

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
https://dropmefiles.com/S4APz
Screen Capture #350.pngScreen Capture #351.png

 

View solution in original post

3 REPLIES 3
Ahmedx
Super User
Super User

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
https://dropmefiles.com/S4APz
Screen Capture #350.pngScreen Capture #351.png

 

Thats worked perfectly, thanks!

amitchandak
Super User
Super User

@BobbyBiff , Try like

 

Measure = countx(filter( values('Table'[Product]),calculate(SUM('Table'[Sales]))<10))

 

of you can use dynamic segmentation

Dynamic Segmentation Bucketing Binning
https://community.powerbi.com/t5/Quick-Measures-Gallery/Dynamic-Segmentation-Bucketing-Binning/m-p/1...


Dynamic Segmentation, Bucketing or Binning: https://youtu.be/CuczXPj0N-k

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.