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
PBI_hlpr1
Resolver I
Resolver I

SQL Server and PowerBI DirectQuery mode

Hi all,

 

I have a client masterfile table included in my data model. The table is linked in DirectQuery mode from a SQL Server. In the table query I have added some lines to mock up the data but when I try to replace values in a column based on condition I fail and get the following message: 

 

cfugge_0-1666870740587.png

This is the step I need to do:

 

= Table.ReplaceValue(#"Filtered Rows", each [Group], each if [Group] = "” then [Company] else [Group], Replacer.ReplaceValue, {"Group"})

 

Practically I need to have all cells in column Group filled either with the preexisting value or with the value present in the Company column (both text fields)

 

I can't believe this is not possible in DirectQuery mode. What am I doing wrong?

 

Thanks,

C.

2 REPLIES 2
PBI_hlpr1
Resolver I
Resolver I

Hi there, thanks for your reply.

 

I did actually try the first method above and it did not work. After adding the new column I couldn’t populate it conditionally and got the same message. I will try the second solution (If I can find the way). At the end if nothing works I will accept the import mode but we are talking about a very large table to be possibly used in several reports and would be a real waste of space.

 

Many thanks indeed; I will let you know how it goes.

 

Regards,

C.

DataInsights
Super User
Super User

@PBI_hlpr1,

 

One approach would be to add a custom column in Power Query with the "if" statement, and then remove the original column Group. You could also use custom SQL with a CASE statement. With custom SQL, you'll need to put all transformations in the SQL (no M transformations).





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.

Top Solution Authors