Power BI - Blank/Empty to 0

rkrt1

New Member
Joined
Jul 24, 2022
Messages
19
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Hi Lovely Fellows

I have a PBI report and have plenty of columns with empty values. I want to replace all empty cells with 0 in all columns (not each column individually).

Anybody can pls share an approach to accomplish this?

Thanks
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Could you adjust your source query, and in the editor, CTRL-click each column where you want to replace nulls with 0, then right-click one of them choosing "Replace Values", then fill out the dialog to replace "null" with 0?
 
Upvote 0
Assuming you're working with a column that is populated based off a calculated measure, you could use the below (example from my own PBI):

TOTAL ITEMS COUNTED = IF
('CYCLE COUNT'[TOTAL ITEMS] > 0,IF(CALCULATE(COUNT('CYCLE COUNT'[GAL#]),FILTER('CYCLE COUNT','CYCLE COUNT'[COUNTS]="COUNTED")) = Blank (),
0,
CALCULATE(COUNT('CYCLE COUNT'[GAL#]),FILTER('CYCLE COUNT','CYCLE COUNT'[COUNTS]="COUNTED"))),
CALCULATE(COUNT('CYCLE COUNT'[GAL#]),FILTER('CYCLE COUNT','CYCLE COUNT'[COUNTS]="COUNTED")))

Basically what you're doing is taking your calculation and adding it to a conditional IF statement. Copy your calculation, then type "IF(" and then paste. Close it and type "= BLANK (),0," then you'll paste your calculation again, type "," and then paste your calculation one more time and close it off.
 
Upvote 0
Solution
Assuming you're working with a column that is populated based off a calculated measure, you could use the below (example from my own PBI):

TOTAL ITEMS COUNTED = IF
('CYCLE COUNT'[TOTAL ITEMS] > 0,IF(CALCULATE(COUNT('CYCLE COUNT'[GAL#]),FILTER('CYCLE COUNT','CYCLE COUNT'[COUNTS]="COUNTED")) = Blank (),
0,
CALCULATE(COUNT('CYCLE COUNT'[GAL#]),FILTER('CYCLE COUNT','CYCLE COUNT'[COUNTS]="COUNTED"))),
CALCULATE(COUNT('CYCLE COUNT'[GAL#]),FILTER('CYCLE COUNT','CYCLE COUNT'[COUNTS]="COUNTED")))

Basically what you're doing is taking your calculation and adding it to a conditional IF statement. Copy your calculation, then type "IF(" and then paste. Close it and type "= BLANK (),0," then you'll paste your calculation again, type "," and then paste your calculation one more time and close it off.
Thanks @Randall
 
Upvote 0

Forum statistics

Threads
1,223,631
Messages
6,173,465
Members
452,516
Latest member
archcalx

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top