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
Rosenmeyer
Frequent Visitor

Same query in imported vs direct query wont connect to Date Table

I have 2 identical queries that are respectively imported query and one direct query.

 

I need to make the imported query in direct query so I can make a scheduled refresh.

 

I have a date in the imported sales table [ClosedAt] that is Date/Time, I try and extract the date in a custom column [ClosedAtDate]=

ClosedAtDay = DATE(YEAR('Sales import'[ClosedAt]);MONTH('Sales import'[ClosedAt]);DAY('Sales import'[ClosedAt]))
I make a connection in the relationship model and it works with filters.
 
I do the same for the direct query table and this error happens when I try to filter anything by slicer:
image.png
 
 
 
 
1 ACCEPTED SOLUTION

HI @Rosenmeyer ,

You can't direct use column in measure formula, please add aggregation function to summary column value:

ClosedAtDay =
VAR currDate =
    MAX ( 'Sales import'[ClosedAt] )
RETURN
    DATE ( YEAR ( currDate ); MONTH ( currDate ); DAY ( currDate ) )

Calculated Columns and Measures in DAX 
Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

3 REPLIES 3
v-shex-msft
Community Support
Community Support

Hi @Rosenmeyer ,

According to your error message, it seems like power bi not able to recognized dynamic table field records. I'd like to suggest you use measure to calculate on row contents level.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

@v-shex-msft 

Hi, if I understand you correctly, when I create a measure with the same formula this happens:

 

image.png

HI @Rosenmeyer ,

You can't direct use column in measure formula, please add aggregation function to summary column value:

ClosedAtDay =
VAR currDate =
    MAX ( 'Sales import'[ClosedAt] )
RETURN
    DATE ( YEAR ( currDate ); MONTH ( currDate ); DAY ( currDate ) )

Calculated Columns and Measures in DAX 
Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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.