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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
g_georgiev444
Helper I
Helper I

How to make DAX based on Query and Excel table

Hello,

 

I have a Direct query as a data source and an Excel table with 3 columns. I match the 2 based on Query1.Destination and Sheet1.Column1

g_georgiev444_2-1665992931216.png

 

This is the Query1.destination column results:

g_georgiev444_1-1665991917457.png

They are the same as what Sheet1.Column 1 have. The only possible relationship is 1:many which PowerBI allows.

 

I create a new column in Sheet1 in which I need to put the following logic: IF query1.destination IS EMPTY or NULL THEN Query1.area, else Sheet1.Column3

Column = IF(ISEMPTY(FILTER(Query1, Query1[destination])), FILTER(Query1, Query1[area]), Sheet1[Column3])
 
The reason why I create the new column in Sheet1 data source is because the FILTER option was only available there. I could refer form one data source to the other only through Sheet1 new column.
 
The goal: I want to have a column, which gives Area based on Destination.
 
This is the error I get
g_georgiev444_3-1665993063147.png

 

Now, regarding the source data columns:
- query1.destination can be null;
- sheet1.column1 has a set of destuinations and is never null;
- sheet1.column3 can be null or empty;
- query1.destination=sheet1.column1.
1 ACCEPTED SOLUTION
g_georgiev444
Helper I
Helper I

I found a solution to my problem. 

 

I created a new MERGED AS NEW table that combines Query1 and Sheet1. Relationship was done in the same way as before: Query1[destination]=Sheet1[column1].

 

In this way the new additional column easily accepts the formula:

Column = IF(ISEMPTY(MergedTable[destination]), MergedTable[area], MergedTable[Column3])

 

Then all visuals are done with the columns from the merged table.

View solution in original post

3 REPLIES 3
g_georgiev444
Helper I
Helper I

I found a solution to my problem. 

 

I created a new MERGED AS NEW table that combines Query1 and Sheet1. Relationship was done in the same way as before: Query1[destination]=Sheet1[column1].

 

In this way the new additional column easily accepts the formula:

Column = IF(ISEMPTY(MergedTable[destination]), MergedTable[area], MergedTable[Column3])

 

Then all visuals are done with the columns from the merged table.

amitchandak
Super User
Super User

@g_georgiev444 , You are returning the filter, which gives a table. You need use function like Sum/min/max/sumx/minx/maxx etc to get only one value

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

Hello @amitchandak ,

 

Thank you for the answer. Unfortunately I do not see how it is possible to use min/max when the match happens on 1 specific cell from sheet1.column1. I do not want to return the whole table. There is only 1 record that corresponds to the destination from Query1. 

 

Even if I put min/max in front of the FILTER I still get error.

 

I need for every row in Query1 to get data in new column depending on the rule above. 

g_georgiev444_0-1666009200600.png

 

I am watching your videos, but cannot find a similar case.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors