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
JCtx
New Member

Newbi - Help Filtering Matching Values Within the Same Table

Hello all! I'm new to Power BI and I'm sure there is a simple answer for this, but I'm stumped.

 

I have the following table:

JCtx_0-1686456789992.png


Each ticket_number with the type "Incident" should have a value in the problem_id column which links that ticket_number to another ticket_number. In this case, ticket_numbers 4, 5, and 6 are related to ticket_numbers 1, 2, and 2, respectively.

 

I'm trying to create a table visualization which displays the following:

Column 1: The ticket_number of all tickets which have the type "problem".

Column 2: A count of all rows containing the problem_id that matches the ticket_number.

 

It should look like this:

JCtx_1-1686457362392.png

Ticket # 1 has 1 ticket which references it as a problem_id (ticket #4)
Ticket #2 has 2 tickets which reference it as a problem_id (tickets #5 and 6)
Ticket #3 does not have any tickets which reference it as a problem_id but should still be displayed because it has the type "Problem".

 

Any help would be greatly appreciated.

2 ACCEPTED SOLUTIONS
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here (my signature).

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

Jihwan_Kim
Super User
Super User

HI,

I am not sure how your datamodel looks like, but please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1686464519193.png

 

 

Incident count expected result: =
VAR _currentrow =
    MAX ( Data[Ticket_number] )
VAR _t =
    FILTER ( Data, Data[Type] = "Problem" )
VAR _problem =
    FILTER ( ALL ( Data ), Data[Problem_id] = _currentrow )
RETURN
    IF ( COUNTROWS ( _t ) = 1, COUNTROWS ( _problem ) + 0 )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

5 REPLIES 5
Jihwan_Kim
Super User
Super User

HI,

I am not sure how your datamodel looks like, but please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1686464519193.png

 

 

Incident count expected result: =
VAR _currentrow =
    MAX ( Data[Ticket_number] )
VAR _t =
    FILTER ( Data, Data[Type] = "Problem" )
VAR _problem =
    FILTER ( ALL ( Data ), Data[Problem_id] = _currentrow )
RETURN
    IF ( COUNTROWS ( _t ) = 1, COUNTROWS ( _problem ) + 0 )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Thank you for your help. This worked exactly as desired. It even accounted for another scenario I had not considered, which is if the problem_id for the current row is greater than the ticket_number.

Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here (my signature).

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thank you for your help. This also achieved the desired result.

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

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

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.