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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
cmcgo3
Helper II
Helper II

Need a Measure or Calculated Column for Visual

This is probably an easy fix, but I cannot figure out if I need a calculated column or DAX measure.  I do not get the result I want when applying a filter in visual (clustered bar chart).

I have Player 'A' and Player 'B' that participated in both Year 2022 and 2023.  Players 'C' only participated in 2023, while Player 'D' only particpated in 2022.  

I need a filter that excludes Players 'C' and 'D' because I only want to show players that particpated in both 2022 and 2023 in the visual.

 

 

cmcgo3_0-1707138515599.png

 

 

 

 

  filter.pbix 

1 ACCEPTED SOLUTION

Awesome! That worked for me!  I appreciate the help...

View solution in original post

2 REPLIES 2
AndrewPF
Helper V
Helper V

There may be easier ways but this is my first thought. 

 

In Power Query, create a new table from your original data (use "Reference"). 

Add an index (this is only so that the group by function retains the year order). 

Group by Player ID and summarise Year (use Text.Combine function - you will have to edit the Group by AFTER you have created it): 

 

let 

Source = Table,
#"Changed Type" = Table.TransformColumnTypes(Source,{{"year", type text}}),
#"Removed Duplicates" = Table.Distinct(#"Changed Type", {"year", "player"}),
#"Sorted Rows" = Table.Sort(#"Removed Duplicates",{{"player", Order.Ascending}, {"year", Order.Ascending}}),
#"Added Index" = Table.AddIndexColumn(#"Sorted Rows", "Index", 0, 1, Int64.Type),
#"Grouped Rows" = Table.Group(#"Added Index", {"player"}, {{"Years", each Text.Combine([year], "; "), type nullable text}})
in
#"Grouped Rows"

 

Now go to Model View, and create a relationship on Player ID between your new and original tables (it may already do it - but you need to decide whether you want the relationship to be one-way or both ways). 

 

The either add a new slicer with the new combined year variable from the new table, or add a visual-level or page-level filter. 

Awesome! That worked for me!  I appreciate the help...

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors