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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
arvindyadav
Post Partisan
Post Partisan

How to compare two column with the same name with the different table in power bi.

Hi Team,

Need help regarding how I can compare two tables having the same column name. 

For example

Table 1- Last 3 days Table 2- yesterdays
NameRpc NameRpc
Arvind1 Arvind2.5
Yadav0.23 soumyadeep2
Pushkal0.5 Pushkal2.3
Soumyadeep0.45 Ashish1.5
     

So I need collated form of a new table which provides me Table name Result i.e, In last 3 days and Yesterdays table which name exist in both tables which one is moved out and which is New coming into the pictures.

I need output as

Needed Table(From Table-1 & Table -2)
NameOutput
ArvindExist
YadavMove Out
PushkalExist
SoumyadeepExist
AshishNew

 

Thanks,

Arvind

1 ACCEPTED SOLUTION

Hey @arvindyadav 

from my understanding the relationships of the model should look like this:

image.png

 

This will allow to create a report like this:

image.png

Please be aware that the columns Name and Output are used from the table New Table. The table "New Table" to filter both tables. I think it will a good idea to rename the column RPC accordingly to make it somewhat simpler to differentiate between both columns, eg. "RPC (...) Yesterday". Make sure that you use the "Name" column from the table "New Table". 

 

Hopefully this is providing what you are looking for. 

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

8 REPLIES 8
TomMartens
Super User
Super User

Hey,

I created a new table "New Table" using this DAX statement:

New Table = 
DISTINCT(
    UNION(
        VALUES(Table1[Name])
        ,VALUES('Table2'[Name])
    )
)

Then I create a calculated column using this DAX statement:

Output = 
var thisName = 'New Table'[Name]
var tExist = INTERSECT(VALUES('Table1'[Name]), VALUES('Table2'[Name]))
var tMoveOut = EXCEPT(VALUES('Table1'[Name]), VALUES('Table2'[Name]))
var tNew = EXCEPT(VALUES('Table2'[Name]), VALUES('Table1'[Name]))
return
SWITCH(
    TRUE()
    ,thisName in tExist, "Exist"
    ,thisName in tMoveOut, "Move Out"
    ,thisName in tNew, "New"
    ,"this is odd"
)

After this the table New Table looks like this:

image.png

Hopefully this is what you are looking for.

 

Regards,

Tom

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Hi @TomMartens ,

 

Thank You Very Much!!

It works but when I adding Table1 or table 2 RPC value then it reflects the same the number for all Name. How to fix this problem.

 

Same stats.PNG

Thanks,

Arvind

hi, @arvindyadav 

You just need to create the relationship between table1 and new table by Name column and create the relationship between table2 and new table by Name column too.

 

Best Regards,

Lin

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-lili6-msft ,

 

How to create a relationship between the table.

I tried but nothing happens.

 

Thanks,

Arvind

hi, @arvindyadav 

you could change Cross filter direction is "Both" and try it again.

If still have the issue, could you please share your sample pbix file, there should be something wrong in other.

 

Best Regards,

Lin

 

 

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-lili6-msft ,

 

So basically I able to manage table1(Yesterdays) and Table2(Last 3 Days) tables relationship but when I try to relate New Table to any of the tables then I am getting a message like below:-

 

Relationship.PNG

 

Hey @arvindyadav 

from my understanding the relationships of the model should look like this:

image.png

 

This will allow to create a report like this:

image.png

Please be aware that the columns Name and Output are used from the table New Table. The table "New Table" to filter both tables. I think it will a good idea to rename the column RPC accordingly to make it somewhat simpler to differentiate between both columns, eg. "RPC (...) Yesterday". Make sure that you use the "Name" column from the table "New Table". 

 

Hopefully this is providing what you are looking for. 

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Hi @TomMartens ,

 

Thank You So Much.

It's work for me.

 

Thanks,

Arvind

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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