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! Learn more

Reply
Anonymous
Not applicable

Check if one of many rows contains value

Hi all,

 

We have a Sales Table containing

 

JobID, ServiceTypeID

 

An example could be:

 

JobIDServiceID
11
12
21
23

 

If I want to mark the JobIDs that includes ServiceID 3, how would I do that?

 

I do not just want to filter for ServiceID = 3, as I want to see all Services included for the JobID.

 

So in the above example, JobID 2 contains ServiceID 1 and 3. I would love to see both in a table.

 

So ideally, my output would be something like:

 

 

JobIDServiceIDMarked
11FALSE
12FALSE
21TRUE
23TRUE
1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

Try this measure

Measure = 
VAR _JobIDs = DISTINCT(SELECTCOLUMNS(FILTER(ALL('Table'),'Table'[ServiceID]=3),"Job_ID",[JobID]))
RETURN
IF(SELECTEDVALUE('Table'[JobID]) IN _JobIDs, "True", "False")

062103.jpg

Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.

View solution in original post

4 REPLIES 4
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

Try this measure

Measure = 
VAR _JobIDs = DISTINCT(SELECTCOLUMNS(FILTER(ALL('Table'),'Table'[ServiceID]=3),"Job_ID",[JobID]))
RETURN
IF(SELECTEDVALUE('Table'[JobID]) IN _JobIDs, "True", "False")

062103.jpg

Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.

Thanks for this answer, 

 

I was able to apply it for my problem.

I would like to compare if the one Service-ID is part of a list of Job IDs (around 700) but the performence of this measure is very slow. Do you have any idea how I can improve it because the data set I use is a bigger one. 

 

Best 

Felix 

CNENFRNL
Community Champion
Community Champion

Screenshot 2021-06-17 110153.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Fowmy
Super User
Super User

@Anonymous 

To achieve this, first, you need to create a disconnected table. Click on New Table under Modeling > New Table.

You can find PBIX file below my signature

 

Fowmy_0-1623919555759.png

Create the following measure which will get the selected service ID from the new table and identify each row that falls under the same job id. Then assign it to the visual filter and set it equal to 1.

Service Selected = 

var __serviceselected = SELECTEDVALUE('Service Slicer'[ServiceID]) return
var __commonjobid = CALCULATE(MAX(Table1[JobID]), Table1[ServiceID] = __serviceselected)
return

    INT(HASONEVALUE(Table1[JobID]) && MAX(Table1[JobID]) = __commonjobid)

Fowmy_1-1623919687945.png

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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