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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
djerryanderson
Regular Visitor

Apply a custom Query to a salesforce data object import

I'm new to Power BI and DAX. Been using SSRS and Visual Studio for a few years so I'm used to how that works. I've figured out how to connect and import data from Salesforce (in my case the Contacts table). I go to the DAX query view and write a custom query that creates the table I want. I cannot figure out to apply that output to report!

 

How do I get this query (which works perfectly):

djerryanderson_2-1731433289212.png

 

To this:

djerryanderson_1-1731433257141.png

BTW I have tried the Advanced Editor in Transform Data and tried "meshing" my query to the data import but although it says the syntax is correct I get errors:

djerryanderson_3-1731433434564.pngdjerryanderson_4-1731433456991.png

I'm sure I'm going about this all wrong. I must be bad at finding tutorials that cover this as well because I can't find any step by step walkthroughs on it. I can probably figure it out if I just new "where" to link the report to the table that the custom query creates. Right now it just shows the entire contacts table. 

1 ACCEPTED SOLUTION

@djerryanderson 

I did not look into your code, just saw the IF and replied 🙂

The DAX code you wrote could be converted in to a table New Table under Modeling tab

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

5 REPLIES 5
djerryanderson
Regular Visitor

This was just an issue with using the dev studio correctly. Using @Fowmy's suggestion I figured out how to add the table to the report. That's all I really needed to do. I've used SSRS for a few years and just couldn't figure out (in Power BI) how to add the table to the report so I could actually "use" it.

 

djerryanderson_0-1731936228814.png

 

Fowmy
Super User
Super User

@djerryanderson 

Powre Query is case sensitive "IF"  should be "if"

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Well this clears it up a bit - power query v DAX query. SO I need to learn different syntax. The case sentive nature of the "if" apparently is not all I need to do - ISBLANK apparently is not correct either.

Anonymous
Not applicable

Hi @djerryanderson ,

 

Here I create a sample and I think you can refer to it.

vrzhoumsft_0-1731477687191.png

As far as I know, we could only add one column in one time by Table.AddColumn Function. 

Here I suggest you to add columns you need by if... then... else and then use Table.SelectColumns Function.

let
    Source = ...,
    #"Query" = ...,
    #"Added Street" = Table.AddColumn(Query, "Street", each if [MailingCity] = null then [Home_Address_Street_s] else [MailingStreet]),
    #"Added City" = Table.AddColumn(#"Added Street", "City", each if [MailingCity] = null then [Home_Address_City_s] else [MailingCity]),
    #"SelectColumns" = Table.SelectColumns(#"Added City",{"FirstName","LastName","Chirstmas_Gift_C","Street","City"})
in
    #"SelectColumns"

Result of my sample is as below.

vrzhoumsft_1-1731477695072.png

The logic of "State" and "Zip" columns are the same as "Street" and ”City“.

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@djerryanderson 

I did not look into your code, just saw the IF and replied 🙂

The DAX code you wrote could be converted in to a table New Table under Modeling tab

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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