cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SDream7 Regular Visitor
Regular Visitor

Group By - Multiple "OR" Conditions

 

Hello,

 

I'm working with a dataset that contains multiple clients, all who have multiple unique identifers. Clients can match based on any of the Code datafields that are listed below (I've bolded all matching identifers).  In this example, 4 client records are listed but there's truly one single person referenced in all 4 records. I'd like to be able to identify all unique people in my dataset using the desired index column listed at the end of the table.

 

In my real dataset, there are at least 9 datafields that I use to identify clients, but unforuntately, none of these fields are able to match every single record that could possibly belong to each unique client.

 

Is there a way to utilize the Group By feature to get the desired indexing?  

 

Client NameCode 1Code 2 Code 3Desired Indexing
Bob Greenyabc123V1
Bobby Greenabc999T1
B. Greeneqrs123F1
Bob J. Grenneipq777F1

 

 

Thanks,

 
5 REPLIES 5
Phil_Seamark Super Contributor
Super Contributor

Re: Group By - Multiple "OR" Conditions

HI @SDream7

 

Yes, there is!  One question though, are the values in those codes unique to a user, or could the Code 1 of "ABC" ever be used by another person


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

SDream7 Regular Visitor
Regular Visitor

Re: Group By - Multiple "OR" Conditions

Hi!

The values featured in each column are unique to that given column. However, they will only match within an individual column when belonging to the same client.

So for column 1, abc can appear multiple times, but it will always being to the same client.
BarryB Frequent Visitor
Frequent Visitor

Re: Group By - Multiple "OR" Conditions

Ewww... that looks painful.

No exact solution, and I'll be keeping an eye out for replies ...

 

... but, for me, that sort of logic/business rules of how these clients are identified would be sorted out upstream or as a bit of pre-processing before PowerBI gets to use the data. SQL queries, Excel formulas and macro's ... whatever... and THEN send it on to the visualisation of PowerBI using the PowerQuery Editor.

 

Why? Maintanence and having logic in a clearly found module (for adjustments) separate from the use of clean and concise data used for visualisation, not buried in a PBIX file...

 

Yes it's just a bit more complexity in the flow of data processing but it can help with the end goal of using PowerBI to show data related to identified clients ... I'm questioning whether it's PowerBI's role to work out how those clients are identified from conditional statements.

 

my 2c. YMMV.

 

 

SDream7 Regular Visitor
Regular Visitor

Re: Group By - Multiple "OR" Conditions

I completely agree!  I'm a Power BI novice, so I'm still working on how to manage and prepare data.  All I have avaliable to me is power bi and excel.  Unfortunately however, my excel skills aren't advanced enough to develop VBA codes to automate identification so I'm stuck using Power BI to complete this identification.  Smiley Sad

BarryB Frequent Visitor
Frequent Visitor

Re: Group By - Multiple "OR" Conditions

hmmm... if it went though an access database first...

 

TblClients

---------

ClientID

ClientName

 

TblTransactions

---------------

Code1

Code2

Code3

CodeN

IndexField

 

 

Select TblClients.ClientName, TblTransactions.IndexField, TblTransactions.Code1 as ClientCode

From TblTransactions InnerJoin TblClients

On TblClients.ClientID = TblTransactions.Code1

UNION

Select TblClients.ClientName, TblTransactions.IndexField, TblTransactions.Code2 as ClientCode

From TblTransactions InnerJoin TblClients

On TblClients.ClientID = TblTransactions.Code2

UNION

Select TblClients.ClientName, TblTransactions.IndexField, TblTransactions.Code3 as ClientCode

From TblTransactions InnerJoin TblClients

On TblClients.ClientID = TblTransactions.Code3

UNION

Select TblClients.ClientName, TblTransactions.IndexField, TblTransactions.CodeN as ClientCode

From TblTransactions InnerJoin TblClients

On TblClients.ClientID = TblTransactions.CodeN

 

I'm sure there's a less clunky way to do it with self-joins, but it's 1am here so...

 

 

 

 

 

 

 

 

Helpful resources

Announcements
Community Highlights

Community Highlights

Find out what's new in the Power BI Community!

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

Virtual Launch Event

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Users Online
Currently online: 61 members 1,347 guests
Please welcome our newest community members: