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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
sajit
Frequent Visitor

a single filter for two columns

i have two columns "assigned to" and "assigned by" and there are common people in both the columns.

 

i want to have a single filter to filter out both the columns at once. what i mean to say is, let's say joe has 5 tickets "assigned to" him. and he also has 7 other tickets "assigned by" him. so when i filter with the name of joe, i need to to see 12 tickets in total, i.e. both the assigned to and assigned by tickets. how do i achieve this?

 

ps: i created a new table merging both these columns but I couldn't get a proper relationship between the two tables as there are null values within these columns.

2 ACCEPTED SOLUTIONS
Greg_Deckler
Super User
Super User

@sajit Normally you would unpivot those columns. You could also do a Complex Selector: The Complex Selector - Microsoft Fabric Community

Like:

Measure =
  VAR __User = MAX('User'[User]) // refer to whatever you are using to pick your user
  VAR __AssignedTo = MAX('Table'[assigned to])
  VAR __AssignedBy = MAX('Table'[assigned by])
  VAR __Result = IF(__AssignedTo = __User || __AssignedBy = __User, 1, 0)
RETURN
  __Result

Otherwise, Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

@sajit Thanks for the data, see attached PBIX file which basically implements the complex selector I posted originally.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

6 REPLIES 6
sajit
Frequent Visitor

@Greg_Deckler thank you!

Greg_Deckler
Super User
Super User

@sajit Normally you would unpivot those columns. You could also do a Complex Selector: The Complex Selector - Microsoft Fabric Community

Like:

Measure =
  VAR __User = MAX('User'[User]) // refer to whatever you are using to pick your user
  VAR __AssignedTo = MAX('Table'[assigned to])
  VAR __AssignedBy = MAX('Table'[assigned by])
  VAR __Result = IF(__AssignedTo = __User || __AssignedBy = __User, 1, 0)
RETURN
  __Result

Otherwise, Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler , attached a sample data. "assigned to" and "assigned by" have common people. for example john doe has both tickets assigned by and to him.

sample.png

 

and this output i'm looking for, when i filter by the name of john doe. 
output.png

The report is in tabular form. I want to add a single filter that filters out data from two columns. the filter should act on both the columns instead of one.

i created a new table in which i combined columns 2 & 3 as a new column "Asignee/Owner" and tried to filter from this column but i couldn't establish a relationship between these tables as there are null values in the columns i want to filter from

sajit_1-1712864654123.png


please do let me know if it's clear now

@sajit Can you post the sample data as text?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler , sure. here you go:

Ticket IDAssigned toAssigned byAssigned GroupProduct Categorization Tier 1Product Categorization Tier 2Submit Date
22987Scott StalloneJohn DoeNetworksInternalResearch8/7/2023 19:53
22988Colin BarnesJacob FreyITInternalResearch7/18/2023 21:39
22989John DoeAlex DavidITClientResearch5/10/2023 1:46
22990John DoeAB WillisSystemsInternalResearch1/13/2023 7:33
22991John DoeMichael JohnsonNetworksInternalResearch8/17/2022 8:35
22992Amy StillerYu CheungCloudClientResearch9/21/2023 20:08
22993David WarnerAmy StillerDCInternalLogistics7/12/2023 18:34
22994James AndersonJohn DoeDCInternalMarket5/8/2023 15:45
22995Colin BarnesJohn DoeNetworksInternalMarket5/8/2023 15:28
22996Jacob FreyAlex DavidSystemsClientMarket4/11/2023 19:54
22997Patrick SmithPatrick SmithAnalyticsInternalLogistics3/29/2023 12:44

@sajit Thanks for the data, see attached PBIX file which basically implements the complex selector I posted originally.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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