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
MPC
Regular Visitor

How to replace the blank with zero in Matrix visual

Hi Team,
@amitchandak 
I have a dataset like below.

MPC_0-1688470091200.png

For the above data I have to show Percentages.

MPC_1-1688470143756.png

Requirement Is : there is no data for some zones, instead of Blank I have to show 0%.

DAX I have written is a as follows:

Percentage of project =
var a= CALCULATE(COUNT(Sheet2[Project]))
var b=CALCULATE(COUNT(Sheet2[Project]),ALL(Sheet2[Zone]))
return
IF((a/b)=BLANK(),0,(a/b) )+0
 
Please check and suggest me a suitable answer.
3 REPLIES 3
Anonymous
Not applicable

Hi @MPC,

If these blank part records include in your table, you can simply use 'replace value' function on 'query editor' side to replace null values to zero to achieve your requirement.
If this blank mean not existed match values, you may need to create an unconnected table with all correspond category and use on matrix. Then you can write a measure formula to check the current row and column value to lookup raw table records and add +0 after the expression to handle not existed parts to zero.
Regards,

Xiaoxin Sheng

This only not working 

Percentage of project =
var a= COUNT(Sheet2[Project])
var b=CALCULATE(COUNT(Sheet2[Project]),ALL('Table'[Zone]))
var c=a/b
var d=SELECTEDVALUE(Sheet2[Zone])
return
IF(ISNONTEXT(d),0,c)+0
Result:
MPC_0-1688620850222.png

 

Anonymous
Not applicable

Hi @MPC,

Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

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.