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
Anonymous
Not applicable

Calculate Function not working for referencing columns from different table using Direct Query

Hi,

 

I have created the following calculated column in a PBI report using import query.
Column = CALCULATE(COUNTBLANK(Phone), FILTER(Family, Student[FamilyId] = Family[FamilyId])

 

where as the tables are as follows 

Student IDFamilyID
1F1
2F2
3F1
4F3
5F2

 

FamilyIDMemberPhone
F1Dad016-456-89876
F1Mom 
F1Uncle676-876-98543
F2Dad 
F2Mom412-562-88765
F3Dad416-542-86758

 

So Ideally, the output column would be 

 

Student IDcolumn
11
21
31
40
51

 

But, Now I have to create this report using DirectQuery connection. But when I try the same query, I'm not able to use the Calculate functions in the calculated column.

 

Can you pls help me with a solution for this issue?

1 REPLY 1
v-angzheng-msft
Community Support
Community Support

Hi, @Anonymous 

 

In fact, there are some limitations in calculating columns in direct query mode.

  • Limitations in calculated columns: Calculated columns are limited to being intra-row, as in, they can only refer to values of other columns of the same table, without the use of any aggregate functions. Additionally, the DAX scalar functions, such as LEFT(), that are allowed, are limited to those functions that can be pushed to the underlying source. The functions vary depending upon the exact capabilities of the source. Functions that aren't supported aren't listed in autocomplete when authoring the DAX for a calculated column, and would result in an error if used.

https://docs.microsoft.com/en-us/power-bi/connect-data/desktop-directquery-about#implications-of-using-directquery

 

You can change the storage mode to Import. Go to the Model tab and select the target table, change the storage mode to Import in Advanced under Properties, and then create a new column.

 

 

Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the 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.