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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
H_insight
Helper V
Helper V

Direct Query - Dax Functions

Hi All,

 

I am running a reconciliation exercise between two databases in Power BI. I have chosen direct query mode due to the large volume of data. Below is a simplified model for demonstration, where both databases (Table 1 & 2) have:

  • Date & ID columns. ID Column does have blanks.
  • The active relationship is between the Date column, and the inactive one is between ID’s.

HeshamK_0-1619774455995.png

 

My ask is for matching the tables by “ID” to show “Matched” & “Mismatched” via direct query. I think there is two options to do that:

  • Custom SQL to perform that on the server (I would like to see one table with all records from table 1 & 2 & new matching/mismatch column)
  • Using DAX

I would like to use the 2nd option, DAX. Tried already but not all functions would work with Directquery mode.

Here is my attempt but via Import Mode, which works:

 

Matching Records :=
VAR _matchinginT2 = LOOKUPVALUE(table1[id],table1[id],table2[id])
Return
IF(NOT(ISBLANK(_matchinginT2)),”Matched”,”Mismatched”)

 

 

Unfortunately, the LOOKUPVALUE does not work in direct query.

 

Any input is highly appreciated.

Thanks

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous ,

 

It's a challenge to share a sample file when my question is about DIrectQuery? The connection is direct to the SQL server and not an import model. Hence why I shared a screen of the current model.

 

For now, I have built a custom SQL code to get me the join between the two tables. Shame it can't be done via DAX "Yet"! Thanks for the follow up 👍

 

Best Regards,

Hesham

amitchandak
Super User
Super User

@H_insight ,

 

Try a measure like

countx(filter(values(Table1[ID] ), Table1[ID] = max(Table2[ID])),Table1[ID])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak 

 

The result will always show 1

HeshamK_0-1619776941223.png

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.