Wednesday, 9 April 2025

Power BI

 

Calculating the part number count by supplierId using DAX measures


  • Calculating the count of partnumber based on supplierid
Part Count by Supplier = 
CALCULATE(
    DISTINCTCOUNT('Spec Data'[PartID]),
    ALLEXCEPT('Spec Data', 'Spec Data'[SupplierID])
)

Step 2: Create the Calculated Column for Part Count Category

Next, create a calculated column to categorize the part counts into the specified ranges.

Part Count Category = 
SWITCH(
    TRUE(),
    [Part Count by Supplier] < 10, "Less than 10",
    [Part Count by Supplier] >= 10 && 'YourTable'[Part Count by Supplier] <= 50, "10 to 50",
    [Part Count by Supplier] > 50 && 'YourTable'[Part Count by Supplier] <= 100, "50 to 100",
    [Part Count by Supplier] > 100, "Greater than 100",
    "Unknown"
)

Output as below


No comments:

Post a Comment