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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Philip_K6
Regular Visitor

New Table with max Defects of each File

Hello everyone,

 

I am new to Power BI and DAX. I searched the forum for my problem but cant make it work.

I get my Data in the following Format. For each Coil there is a unique File that numbers the Defects in the order they occur and puts them in their Defect Category. There are about 20 different categories. In the example below i simplified it a bit. 

 

File Name              Order Number          Coil Number            Defect Category              Defect Number         
001-R1.csv001R1A1
001-R1.csv001R1A2
001-R1.csv001R1B3
001-R1.csv001R1A4
001-R2.csv001R2B1
001-R2.csv001R2A2
001-R2.csv001R2A3
001-R2.csv001R2B4
001-R2.csv001R2B5
002-R1.csv002R1A1
002-R1.csv002R1B2
002-R1.csv002R1A3
002-R2.csv002R2A1
002-R2.csv002R2A2
002-R2.csv002R2A3
002-R2.csv002R2A4
002-R2.csv002R2B5

 

Now i want to create a new table that lists the unique file name and the according number of Defects for each Category.

 

File Name (ID)         Defect Count Class "A"          Defect Count Class "B"
001-R131
001-R223
002-R121
002-R241


I already listed all the File Names with the DISTINCT Function 

File Name (ID) = DISTINCT(Table[File Name])

But i dont know how to count the number of defects for each class for the corresponding file name.

1 ACCEPTED SOLUTION

Hi @Philip_K6 

Thanks for your reply.

>>  i want to create a new table that lists the unique file name and the according number of Defects for each Category.... I wanted to create a seperate table not a measure. ...I already listed all the File Names with the DISTINCT Function 

Oh I got it. So we only need to perform distinct count on the basis of the file name list you created.

Please try this, create the 2 columns in your list table,

Defect Count A = COUNTX(FILTER('Table','Table'[File Name]=EARLIER('File Name (ID)'[File Name]) && 'Table'[Defect Category]="A" ),[Coil Number])
Defect Count B = COUNTX(FILTER('Table','Table'[File Name]=EARLIER('File Name (ID)'[File Name]) && 'Table'[Defect Category]="B" ),[Coil Number])

result

vxiaotang_0-1658905911888.png

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
Philip_K6
Regular Visitor

@v-xiaotang thank you for your reply.

Thats what I want to do but not as a visual. I want to reference that table again so I can group the seperate coils into ranges of defects. Something like this:

Philip_K6_0-1658401190416.png

 

Hi @Philip_K6 

Thanks for your reply.

>>  i want to create a new table that lists the unique file name and the according number of Defects for each Category.... I wanted to create a seperate table not a measure. ...I already listed all the File Names with the DISTINCT Function 

Oh I got it. So we only need to perform distinct count on the basis of the file name list you created.

Please try this, create the 2 columns in your list table,

Defect Count A = COUNTX(FILTER('Table','Table'[File Name]=EARLIER('File Name (ID)'[File Name]) && 'Table'[Defect Category]="A" ),[Coil Number])
Defect Count B = COUNTX(FILTER('Table','Table'[File Name]=EARLIER('File Name (ID)'[File Name]) && 'Table'[Defect Category]="B" ),[Coil Number])

result

vxiaotang_0-1658905911888.png

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

Thank you @v-xiaotang thats what i wanted to do! 

v-xiaotang
Community Support
Community Support

Hi @Philip_K6 

Thanks for reaching out to us.

>> expected result

vxiaotang_1-1657878088746.png

You can try this, 

vxiaotang_0-1657878074226.png

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

Philip_K6
Regular Visitor

@amitchandak thank you for your reply.
What i eventually want to do is create a histogram that shows the number of coils that lie in a specific range of defects filtered by the Defect Class. Thats why I wanted to create a seperate table like I said in my post and not a measure. But if you think thats possible with a measure please tell me how.

amitchandak
Super User
Super User

@Philip_K6 , You should able to do that using a measure

 

count(Table[Defect Number])

 

And plot in visual with file name and class

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors