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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Clout
Helper III
Helper III

Check if column exists in table and then do a calculation with the column, else output the raw value

Hello,

 

this is my my custom column in a table:

 

IF [BB1_SV_faktor] is null then [BB1_SV] ELSE Value.Multiply([BB1_SV_faktor],[BB1_SV]) 

 

But I have data too where the column "BB1_SV_faktor" doesn't exists. So I want to check first if the column exists, and then make the calculation. Otherwise I want to only have the values of the column "BB1_SV" in the custom column.

 

I tried this out but it still tries to find "BB1_SV_faktor":

 

IF Table.HasColumns([BB1_SV_faktor]) then (IF [BB1_SV_faktor] is null then [BB1_SV] else Value.Multiply([BB1_SV_faktor],[BB1_SV])) else [BB1_SV]

 

Thanks in advance!

5 REPLIES 5
Anonymous
Not applicable

Hi @Clout ,

 

Could you please share some sample data and the expected result to have a clear understanding of your question? I can do some tests for you.

You can save your files in some cloud sharing platforms and share the link here.

How to provide sample data in the Power BI Forum - Microsoft Power BI Community

 

Best Regards,

Yuna

themistoklis
Community Champion
Community Champion

@Clout 

 

Can you try checking if it doesnt exist by adding not in front of the function and swifting the following if formula:

e.g.

 IF not Table.HasColumns([BB1_SV_faktor]) 

Tank you for your comment @themistoklis 

 

I tried it out with this command:

 

IF NOT Table.HasColumns([BB1_SV_faktor]) then [BB1_SV] else Value.Multiply([BB1_SV], 1)

 

So even when I don't try to multiplicate the values with "BB1_SV_faktor", Power Query tries to find the column "BB1_SV_faktor" when its named in the command.

 

Edit: Is it maybe possible with DAX instead to do the calculation in "M" when its not possible there?

I know this is an old thread, but just in case someone has the same question: the syntax is incorrect and should be as follows:

IF NOT Table.HasColumns(PreviousStepName,{"BB1_SV_faktor"}) then [BB1_SV] else Value.Multiply([BB1_SV], 1)

Anonymous
Not applicable

Did it work with DAX instead of M query?

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.