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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
sumpekung
Frequent Visitor

Filter out the data when the conditions are not fully match

Hi,

 

I'm trying to sort some rows out if those rows not match all conditions.

 

I need to compare the defect by date between 2 operations but I want to compare only the lot that already pass both operations. Is there any way to sort the rows out via power query or measure function?

 

sumpekung_0-1674716558702.png

 

Thanks,

 

1 ACCEPTED SOLUTION

Hi @olgad ,

Thanks again krub. I already fix the issue. I create MAX Operation column by power query and sort the operation#1 out and use measure as below.

Test Count = If(If(CALCULATE(Count('Table'[Lot]), 'Table'[Operation] = 2) > 0 ,1,0)=1, Sum('Table'[Defect]))

sumpekung_0-1675042513139.pngsumpekung_1-1675042569840.png

sumpekung_2-1675042761143.png

 

 

View solution in original post

8 REPLIES 8
wdx223_Daniel
Super User
Super User

OperationCount=CALCULATE(DISTINCTCOUNT(Table[Operation]),ALLEXCEPT(Table,Table[Date],Table[Lot]))

FreemanZ
Super User
Super User

hi @sumpekung 

 

not sure if i fully get you, you may try to add a measure like this:

measure = COUNTROWS(VALUES(TableName[Operation]))

 

you may plot a table visual with Lot column and the measure, like this:

FreemanZ_0-1674737466022.png

 

or you can feed filter pane for a visual with the measure and show the items when the value is 2, like this:

FreemanZ_1-1674737556790.png

 

My whole data table contains many rows for each lot and not same row quantity in each lot, so it doesn't work with ny data.
Thank you in advance krub @FreemanZ .

hi @sumpekung 

then could you update your sample date to fully refect the issue?

Thank you in advance for follow up with a great support krub. Anyway, I already fixed my problem with the idea from you and @olgad .

olgad
Super User
Super User

Hi, 
New Count=

If(If(CALCULATE(Count(Table[lot]), Table[Operations] = 1) = CALCULATE(Count(Table[lot]), Table[Operations] = 2),1,0)=1, Sum(Table[Defect]))
olgad_0-1674737190837.png

Please kudo and like the solution if it works for you. 


DID I ANSWER YOUR QUESTION? PLEASE MARK MY POST AS A SOLUTION! APPRECIATE YOUR KUDO/LIKE!
PROUD TO BE A SUPER USER!
Best Stories, Interesting Cases: PowerBI Storytime Newsletter
Linkedin Profile: Linkedin
YouTube Channel: PowerBI Storytime

Hi @olgad ,

Thanks again krub. I already fix the issue. I create MAX Operation column by power query and sort the operation#1 out and use measure as below.

Test Count = If(If(CALCULATE(Count('Table'[Lot]), 'Table'[Operation] = 2) > 0 ,1,0)=1, Sum('Table'[Defect]))

sumpekung_0-1675042513139.pngsumpekung_1-1675042569840.png

sumpekung_2-1675042761143.png

 

 

Thanks @olgad , sorry for the less information I provide. My data set contains multiple days, then it still sum defect from all lots I have. Now I'm trying to adapt your idea if it can work.

sumpekung_0-1674790316978.png

sumpekung_1-1674790329570.png

 

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors