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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
newbie_but_conf
Helper II
Helper II

Group by ID and subID and check if two values occur togheter

Hi,

I have a case where I wan't to find the combination of ID and Idref where Message and Search occurs together. I'm not sure how I can create the column "Contains Message & Search". It should group by ID and Idref and check if both Message and Search occurs. If it does, then for all rows for the combination of ID and Idref then return 1, otherwise just return 0.
I've tried some combinations of group by, summarize (but don't want to create a new table).. 
Would be great if someone can help me.

 

IDIdreftypeContains Message & Search
11Message0
11Given0
12Search0
12Given0
21Message1
21Search1
21Given1
31Message0
32Message0
32Given0
33Message1
33Search1
33Given1

 

Thanks!

1 ACCEPTED SOLUTION
Jonvoge
Solution Supplier
Solution Supplier

Hi.

 

You can use the following measure:

Jonvoge_0-1709289395369.png

 

Measure =

var HasMessage = CALCULATE(COUNTROWS('Table'), Filter(ALLEXCEPT('Table', 'Table'[Id], 'Table'[Idref]), 'Table'[type] = "Message"))
var HasSearch = CALCULATE(COUNTROWS('Table'), Filter(ALLEXCEPT('Table', 'Table'[Id], 'Table'[Idref]), 'Table'[type] = "Search"))

RETURN
If(HasMessage > 0 && HasSearch > 0, 1, 0)

_____________________________________________________
I hope my comment was helpful.
If your question was answered, please mark your post as 'Solved' and consider giving me a 'Thumbs Up'.
Find me on LinkedIn, Sessionize, or my blog Downhill Data

View solution in original post

1 REPLY 1
Jonvoge
Solution Supplier
Solution Supplier

Hi.

 

You can use the following measure:

Jonvoge_0-1709289395369.png

 

Measure =

var HasMessage = CALCULATE(COUNTROWS('Table'), Filter(ALLEXCEPT('Table', 'Table'[Id], 'Table'[Idref]), 'Table'[type] = "Message"))
var HasSearch = CALCULATE(COUNTROWS('Table'), Filter(ALLEXCEPT('Table', 'Table'[Id], 'Table'[Idref]), 'Table'[type] = "Search"))

RETURN
If(HasMessage > 0 && HasSearch > 0, 1, 0)

_____________________________________________________
I hope my comment was helpful.
If your question was answered, please mark your post as 'Solved' and consider giving me a 'Thumbs Up'.
Find me on LinkedIn, Sessionize, or my blog Downhill Data

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors