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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
bballjoe12
Frequent Visitor

Grouping column values and setting a flag based on another column's value?

I have a large set of data that contains ticket numbers and the history of the Groups the ticket numbers were assigned to. The data may consist of 4 rows for, example, for ticket # 126748, because it was assigned to 4 different teams.

 

I'm trying to figure out a measure that will set the flag to '1' if the ticket numbers assigned group was ever 'Desktop Support.' If the ticket number's assigned group did include 'Desktop Support' then I want to set the flag on every row of that ticket # to '1'.  Here is a screenshot of what I am trying to achieve:

 

bballjoe12_0-1643783724273.png

 

I've searched and tried many different DAX combinations and have been very unsuccessful.  All of my data is on the same table.  Does anyone know a DAX measure that would help me achieve this?

1 ACCEPTED SOLUTION
ValtteriN
Super User
Super User

Hi,

Here is one way to do this:

Measure 15 = if(CALCULATE(CONTAINS('Temperature (2)','Temperature (2)'[Temperature],"Warm"),ALLEXCEPT('Temperature (2)','Temperature (2)'[GRP])),1,0)
 
This measure checks if a group contain "Warm" and will return 1 to all rows where this is the case.
ValtteriN_0-1643784502834.png


I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/







Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

6 REPLIES 6
CNENFRNL
Community Champion
Community Champion

Excel worksheet formula is already enough

CNENFRNL_0-1643798256113.png

 

CNENFRNL_1-1643798688647.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!

ValtteriN
Super User
Super User

Hi,

Here is one way to do this:

Measure 15 = if(CALCULATE(CONTAINS('Temperature (2)','Temperature (2)'[Temperature],"Warm"),ALLEXCEPT('Temperature (2)','Temperature (2)'[GRP])),1,0)
 
This measure checks if a group contain "Warm" and will return 1 to all rows where this is the case.
ValtteriN_0-1643784502834.png


I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/







Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@ValtteriN 

Can I use a wildcard within the syntax to get groups that start with DS? Here is the syntax I am using to get one group:

DS Assigned = if(CALCULATE(CONTAINS('Incident History','Incident History'[Assigned Group],"DS_Unity"),ALLEXCEPT('Incident History','Incident History'[Incident #])),1,0)

 

I tried this but had no luck:

DS Assigned = if(CALCULATE(CONTAINS('Incident History','Incident History'[Assigned Group],"DS_*"),ALLEXCEPT('Incident History','Incident History'[Incident #])),1,0)

 

How would I use a wildcard within the syntax to search any group that starts with 'DS'?

@ValtteriN 

 

How would I change this syntax to use it in creating a new table rather than just a measure?

 

DS Assigned = if(CALCULATE(CONTAINS('Incident History','Incident History'[Assigned Group],"DS_Unity"),ALLEXCEPT('Incident History','Incident History'[Incident #])),1,0)

Have a look at CONTAINSSTRING:
e.g.
wildcard = 

CONTAINSSTRING(max(Temperature[Temperature]),"Warm")

non-wild =
CONTAINS(Temperature,Temperature[Temperature],"Warm")

ValtteriN_0-1643820220036.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




You are a genius! This works exactly as I need.  Thank you so much!

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.