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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
mdrammeh
Helper III
Helper III

How to add a blank cell when formula returns error or null in Power Query

Hello,

 

I have two calculated columns with different expressions in Power Query. I want to calculate the difference between the two columns and return a blank value where the formula returns an error message. 

 

The first column (% Change) is calculated by the difference of =  (Projected $ - Cost)/Projected

The second column used the result of the first column and subtracted it from 1. i.e. % Complete = 1-(% Change) value. 

 

This way when the result is displayed on my power PowerPivot table, the value in the cell remains blank instead of "NA#".Also, if there is a better way to do this calculation, please share your thoughts as well.Exhibit 1.PNGExhibit -2.PNG

 

Thanks!

1 ACCEPTED SOLUTION

Yes, I do suggest you use DAX measures in Power BI Desktop  (or Excel if you are using Excel with powerpivot).

 

View solution in original post

3 REPLIES 3
Datatouille
Solution Sage
Solution Sage

Hi @mdrammeh

 

I think you should not use Power Query but Dax language to perform this kind of calculations.

And because it involves ratios, you should create DAX measures rather than calculated columns - otherwise you'll get wrong figures when analysing your percentages.

Why ? Because a/b + c/d + e/ f is NOT equal to (a + c + e) / (b+d+f)

 

You should always do "the ratios of the sum rather than the sum of the ratios" (Kimball).

 

So create these 2 measures:

[Pct Change] = 1 - Sum(Table[Cost]) / Sum (Table[Projected])

[Pct Complete] = 1 - [Pct Change]

 

Format them as % and use them in any graphs. These measures will automaticcaly adjust to filter context.

Your Pct calculations will be both correct and dynamic.

So are you suggesting I use DAX functions in Excel or Power BI instead of Power Query? Could you share an example from the Query editor? 

Yes, I do suggest you use DAX measures in Power BI Desktop  (or Excel if you are using Excel with powerpivot).

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors