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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
KvO88
Frequent Visitor

Exclude group of unique ID in count measure that contain a certain value

I would like to know what the count of Work Orders is that do not contain "Parts" (Line Type). So exclude any work order that at least contain 1 line with Line Type "Parts". 

See example of the table below.


Work Order #    Line Type

WO-00673116Labor
WO-00673116Parts
WO-00673116Expenses
WO-00672716Labor
WO-00672701Labor
WO-00672404Labor
WO-00672404Parts
WO-00672404Expenses
WO-00672302Labor
WO-00672089Labor
WO-00671319Labor
WO-00671256Labor
WO-00670986Labor
WO-00670986Parts
WO-00670986Expenses
WO-00670463Labor
WO-00670462Labor
1 ACCEPTED SOLUTION
v-binbinyu-msft
Community Support
Community Support

Hi @PijushRoy ,  many thanks for your very quick and effective replies.

Hi @KvO88 ,

Please try to create measure with below dax formual:

 

MEASURE =
VAR tmp =
    SUMMARIZE (
        'Table',
        'Table'[Work Order # ],
        "Concate Line Type", CONCATENATEX ( 'Table', [Line Type], "," )
    )
VAR tmp1 =
    FILTER ( tmp, NOT ( CONTAINSSTRING ( [Concate Line Type], "Parts" ) ) )
RETURN
    COUNTROWS ( tmp1 )

 

vbinbinyumsft_0-1711610453678.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
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

6 REPLIES 6
v-binbinyu-msft
Community Support
Community Support

Hi @PijushRoy ,  many thanks for your very quick and effective replies.

Hi @KvO88 ,

Please try to create measure with below dax formual:

 

MEASURE =
VAR tmp =
    SUMMARIZE (
        'Table',
        'Table'[Work Order # ],
        "Concate Line Type", CONCATENATEX ( 'Table', [Line Type], "," )
    )
VAR tmp1 =
    FILTER ( tmp, NOT ( CONTAINSSTRING ( [Concate Line Type], "Parts" ) ) )
RETURN
    COUNTROWS ( tmp1 )

 

vbinbinyumsft_0-1711610453678.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

PijushRoy
Super User
Super User

Hi @KvO88 

Please use the below DAX in measure. 

 

 

Measure 2 = CALCULATE(
    DISTINCTCOUNT('YourTable'[Work Order #]),
    'YourTable'[Line Type] <> "Parts")

 

 

PijushRoy_0-1711007566462.png

 


Let me know if that works for you


If your requirement is solved, please mark THIS ANSWER as SOLUTION ✔️ and help other users find the solution quickly. Please hit the Thumbs Up 👍 button if this comment helps you.

Thanks
Pijush
Linkedin

@PijushRoy Thanks for thinking along. However, this only excludes the rows that do not have the line type "Parts". I only want to see the count of Work Orders that does not contain "Parts" at all. In the screenshot I only want to count WO-00591022, WO-00591040 and WO-00591219. I do not want include WO-00591263 and WO-00591438 because do do not only contain Labor. 

KvO88_0-1711350336876.png

 

 

AnalyticsWizard
Solution Supplier
Solution Supplier

hi @KvO88 

  1. Create a New Measure:

    • Go to the Modeling tab in Power BI.
    • Click on New Measure.
    • Name your measure (e.g., “Work Orders Without Parts”).
  2. Write the DAX Formula:

    • Use the following DAX formula to count the work orders without the “Parts” line type:
      Work Orders Without Parts =
      CALCULATE(
          COUNTROWS(YourTableName),
          NOT(YourTableName[Line Type] = "Parts")
      )
      Replace 'YourTableName' with the actual name of your table.
  3. Explanation:

    • The NOT function filters out rows where the “Line Type” is equal to “Parts”.
    • The measure counts the remaining work orders.
  4. Display the Result:

    • Use the newly created measure “Work Orders Without Parts” in your visual to display the count.

Hi @AnalyticsWizard Thanks for thinking along. This measure does not calculate distinct. Since each WO number can have multiple rows, it will not show the number of (distinct) WO's that do not contain Parts. See also my answer to PijushRoy. 

PijushRoy
Super User
Super User

Hi @KvO88 

Please try below DAX in measure

 

Measure 2 = CALCULATE(
    DISTINCTCOUNT('Table (2)'[Work Order #]),
    'Table (2)'[Line Type] <> "Parts")

 

PijushRoy_0-1711007566462.png

 


Let me know if that works for you


If your requirement is solved, please mark THIS ANSWER as SOLUTION ✔️ and help other users find the solution quickly. Please hit the Thumbs Up 👍 button if this comment helps you.

Thanks
Pijush
Linkedin

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.