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
Peter_2020
Helper III
Helper III

Filter with specific definition

Hi all, 

I would like to ask you for help with DAX formula for following situation:

I have this simple table with 2 columns where is order number and operation number:

ORDEROPERATION
1111
1112
2221
3331
3332
3333
3334

And I need to have the list of all orders with note if the specific order contains operation 2 and 4. So expected outcome will looks like this:

ORDERMEASURE
1110
2220
3331

0 means that order doesn´t contain operation 2 and 4 and 1 means that order contains operation 2 and 4.

 

Any idea how to do it?

Thanks.

P. 

1 ACCEPTED SOLUTION
v-angzheng-msft
Community Support
Community Support

Hi, @Peter_2020 

 

Try to create a measure like this:

Measure = 
VAR _OR_OP=SUMMARIZE(FILTER(ALL('Table'),'Table'[ORDER]=MAX('Table'[ORDER])),[OPERATION])
VAR _IF=
    IF( {2} IN _OR_OP&&{4} IN _OR_OP
        ,1,0
        )

RETURN _IF

Result:

vangzhengmsft_0-1636950094251.png

 

Please refer to the attachment below for details. Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng


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

4 REPLIES 4
v-angzheng-msft
Community Support
Community Support

Hi, @Peter_2020 

 

Try to create a measure like this:

Measure = 
VAR _OR_OP=SUMMARIZE(FILTER(ALL('Table'),'Table'[ORDER]=MAX('Table'[ORDER])),[OPERATION])
VAR _IF=
    IF( {2} IN _OR_OP&&{4} IN _OR_OP
        ,1,0
        )

RETURN _IF

Result:

vangzhengmsft_0-1636950094251.png

 

Please refer to the attachment below for details. Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng


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

@v-angzheng-msft Thanks a lot! it works!

amitchandak
Super User
Super User

@Peter_2020 , Measure like

 

Countx(Summarize(Table, Table[Opearation], "_1",calculate(distinctcount(Table[Operation]) , filter(Table, Table[Operation] in {2,4}  ))) , if( [_1]=2,1,0) )

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

@amitchandak Thanks for the tip but the result is for all orders the same - value 1....

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors