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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric 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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.