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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
SDream7
Helper I
Helper I

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
Employee
Employee

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!

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.

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.

 

 

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.  😞

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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