Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
I have two table visuals that I have created in a dashboard in two seperate pages. This data is from two different data sources that I connected to by direct query. I need a count of how many records match from Table A to Table B by comparing the 'RelaySubstationID', 'RelayCircuitID', 'ProtectionType', 'Setting', and 'Value' columns. The 'Value' column consists of alphanumeric values but I want to compare only the numeric part. In the below case, I'd expect to get a count of 4 matching records. Is there any way to do this or is it outright impossible?
Table A
Table B
Solved! Go to Solution.
Please try this:
Here are 2 sample data:
Table A:
Table B:
Click Transform data in the Home pane to use power query.
Click Custom Column in the Add Column pane:
You can use this m-code to get numbers from columns:
Text.Select([Value],{"0".."9","."})
Add for both 2 tables:
Close&Apply.
Finally, add a measure:
MEASURE =
COUNTROWS (
FILTER (
CROSSJOIN ( 'Table A', 'Table B' ),
'Table A'[Custom] = 'Table B'[Custom]
)
)
The result is as follow:
Best Regards
Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Please try this:
Here are 2 sample data:
Table A:
Table B:
Click Transform data in the Home pane to use power query.
Click Custom Column in the Add Column pane:
You can use this m-code to get numbers from columns:
Text.Select([Value],{"0".."9","."})
Add for both 2 tables:
Close&Apply.
Finally, add a measure:
MEASURE =
COUNTROWS (
FILTER (
CROSSJOIN ( 'Table A', 'Table B' ),
'Table A'[Custom] = 'Table B'[Custom]
)
)
The result is as follow:
Best Regards
Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@blackbach2728 it is possible but before you get there you need to create dimensions table of all the common column that you want to compare against. Each dimension table will link to each data table and then you can compare the value column from both the tables.
This is just an idea, you can tweak the solution as it fits for you.
To compare only number value from value column you can do something like this:
Compare Number Values =
VAR __ValueTableA = IFERROR ( VALUE ( SELECTEDVALUE ( 'TableA'[Value] ) ), BLANK () )
VAR __ValueTableB = IFERROR ( VALUE ( SELECTEDVALUE ( 'TableB'[Value] ) ), BLANK () )
RETURN
SWITCH (
TRUE (),
__ValueTableA == BLANK () && __ValueTableB == BLANK (), "Non number value both A and B",
__ValueTableA == BLANK (), "Non number value table A",
__ValueTableB == BLANK (), "Non number value table B",
__ValueTableA <> __ValueTableB, "Mistmatched numbers",
"Value Matched"
)
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! โค
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos ๐
Feel free to email me with any of your BI needs.
You can do an intersect between the two columns from tables A and B
COUNTROWS ( INTERSECT ( VALUES ( table1[value] ), VALUES ( table2[value] ) ) )
But both columns must contain numbers only. While that can be done in Power Query, that will most likely break query folding as welll, breaking direct query.