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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
RajK2
Helper IV
Helper IV

Classification count by Product Range

Hi

I need DAX Formula product count based on sales amount criteria, Total Sales 6,069,725 * 70% , 20%, 10% for AIR 

example, total product for AIR = 18 then

70% sales by product count = 10,

20 % sales by product count = 5,

10 % sales by product count = 3 however total product AIR is 18 we can't calculate extact sales % to get count as approx is fine.

 

result - if we create table Type and Class and drill down vehicle type, class it will show next level

TYPECLASS
AIR 
EXCELLENT10
V GOOD5
GOOD3
CIRCLE 
EXCELLENT---
V GOOD---
GOOD---

 

 

TABLE Sample :

YYYY-QQTypeVEHICLE TYPEProductSales
2025-Q3AIRBUSURO2316367
2025-Q3AIRBUSFLUID810661
2025-Q3AIRBUSMODULAR806755
2025-Q3AIRBUSSTAR DRIVE598993
2025-Q3AIRBUSVOLVO DING297975
2025-Q3AIRAUTOSTARKE284632
2025-Q3AIRBUSBRAKE265213
2025-Q3AIRBUSATE BRAKE176020
2025-Q3AIRAUTOVALUE160033
2025-Q3AIRAUTOMYCLE74204
2025-Q3AIRAUTOAXLE72967
2025-Q3AIRAUTOCROSSMEMBER71564
2025-Q3AIRBUSABE BRAKE56314
2025-Q3AIRBUSSYSTEM DUALBUS47852
2025-Q3AIRBUSLITTAL15132
2025-Q3AIRAUTOTIMING BELT7649
2025-Q3AIRAUTOVALEO7394
2025-Q3AIRAUTODASHBOARD STEREO0
2025-Q3CIRCLECARSWIFT SERIES2969589
2025-Q3CIRCLECARSERIES  PART946618
2025-Q3CIRCLECAROEC583680
2025-Q3CIRCLECARHORN PART548844
2025-Q3CIRCLECARTABLE PART323616
2025-Q3CIRCLECARELITE STONG48748
1 ACCEPTED SOLUTION
v-karpurapud
Community Support
Community Support

Hi @RajK2 


Thank you for reaching out to the Microsoft Fabric community. And thank you @lbendlin and @Elena_Kalina for sharing helpful insights.
 

We have implement a combination of calculated columns and a measure within the dataset. The classification logic categorizes products into EXCELLENT, V GOOD, and GOOD tiers based on their contribution to total sales, with thresholds at 70%, 90%, and 100% respectively.

--------Measures-------

TotalSalesPerType = 
CALCULATE(
    SUM('SalesData'[Sales]),
    ALLEXCEPT('SalesData', 'SalesData'[Type])
)
-----------------
Product Count = DISTINCTCOUNT('SalesData'[Product])

---Calculated Columns---

CumulativeSales = 
CALCULATE(
    SUM('SalesData'[Sales]),
    FILTER(
        'SalesData',
        'SalesData'[Type] = EARLIER('SalesData'[Type]) &&
        'SalesData'[Sales] >= EARLIER('SalesData'[Sales])
    )
)

------------------------------

CumulativePercent = 
DIVIDE('SalesData'[CumulativeSales], [TotalSalesPerType])

------------------------------

Classification = 
SWITCH(
    TRUE(),
    'SalesData'[CumulativePercent] <= 0.7, "EXCELLENT",
    'SalesData'[CumulativePercent] <= 0.9, "V GOOD",
    "GOOD"
)


Please refer to the attached .pbix file for a working example and review the implementation.

I hope this information proves helpful. If not, please feel free to share additional details, and we will be happy to assist you further.

Regards,
Karpurapu D,
Microsoft Fabric Community Support Team.

View solution in original post

5 REPLIES 5
v-karpurapud
Community Support
Community Support

Hi @RajK2 


Thank you for reaching out to the Microsoft Fabric community. And thank you @lbendlin and @Elena_Kalina for sharing helpful insights.
 

We have implement a combination of calculated columns and a measure within the dataset. The classification logic categorizes products into EXCELLENT, V GOOD, and GOOD tiers based on their contribution to total sales, with thresholds at 70%, 90%, and 100% respectively.

--------Measures-------

TotalSalesPerType = 
CALCULATE(
    SUM('SalesData'[Sales]),
    ALLEXCEPT('SalesData', 'SalesData'[Type])
)
-----------------
Product Count = DISTINCTCOUNT('SalesData'[Product])

---Calculated Columns---

CumulativeSales = 
CALCULATE(
    SUM('SalesData'[Sales]),
    FILTER(
        'SalesData',
        'SalesData'[Type] = EARLIER('SalesData'[Type]) &&
        'SalesData'[Sales] >= EARLIER('SalesData'[Sales])
    )
)

------------------------------

CumulativePercent = 
DIVIDE('SalesData'[CumulativeSales], [TotalSalesPerType])

------------------------------

Classification = 
SWITCH(
    TRUE(),
    'SalesData'[CumulativePercent] <= 0.7, "EXCELLENT",
    'SalesData'[CumulativePercent] <= 0.9, "V GOOD",
    "GOOD"
)


Please refer to the attached .pbix file for a working example and review the implementation.

I hope this information proves helpful. If not, please feel free to share additional details, and we will be happy to assist you further.

Regards,
Karpurapu D,
Microsoft Fabric Community Support Team.

@v-karpurapud 

fantastic and really support me to sort out the solution.

 

steps you explained in DAX and really amazing .. awesome, Thank you

Hi @RajK2 

I'm happy it was useful for you. If you have any questions,please feel free to reach out.


Regards, 
Karpurapu D.

Elena_Kalina
Solution Sage
Solution Sage

Hi @RajK2 

Cteate a calculate column

Tier Simplified = 
VAR CurrentType = 'Table'[Type]
VAR CurrentProductSales = 'Table'[Sales]

// 1. Get total sales for the type
VAR TotalSalesByType =
    CALCULATE(
        SUM('Table'[Sales]),
        FILTER(
            ALL('Table'),
            'Table'[Type] = CurrentType
        )
    )

// 2. Determine product's contribution percentage
VAR SalesShare = CurrentProductSales / TotalSalesByType

// 3. Categorize (adjust thresholds as needed)
RETURN
    SWITCH(
        TRUE(),
        SalesShare >= 0.05, "EXCELLENT",  // Top products (70% of sales)
        SalesShare >= 0.01, "V GOOD",     // Medium products (20% of sales)
        "GOOD"                           // Others (10% of sales)
    )

Elena_Kalina_0-1753117192571.png

You can then rename this value as "Class" in the visual

 

Elena_Kalina_1-1753117282292.png

If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! 

Thank you.

lbendlin
Super User
Super User

Sounds like you want a Pareto.  There are built-in functions in DAX like PERCENTILEX  that can get you there.  Have you tried these?

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Solution Authors