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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Replacing blanks with 0 in matrix visual

Hi, 

 

I currently have this matrix with many blanks in dates where there are no values. The original data does not display zero, so I am trying to find a way to change the blanks in this visual to display zeroes instead. Would anyone know how to go about this? Thank you, any help is appreciated!

 

1 ACCEPTED SOLUTION

@Anonymous , In this case you could use below formula. 

Measure = calculate(count(table[name]))+0

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

View solution in original post

7 REPLIES 7
Samarth_18
Community Champion
Community Champion

Hi @Anonymous ,

 

If its values directly coming from the column then you can try any of the below code by creating a measure.

Measure = max('table'[column])+0
Measure = coalesce(max('table'[column]),0)

 

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Anonymous
Not applicable

Hi, 

 

The issue is that my original data does not contain the missing values. It skips over those. I tried the above measures but it displays all the names instead of counting them. This is how it is currently organized: 

etijerina_0-1650466681530.png

 

I would go to the original data and trasnform the values to zero, but not all days have values for each location in the source data. 

 

Thank you for any help!  

 

Hi @Anonymous ,

You should first create a table with two columns which will look more like a cross join between Dates and Location. i.e. It should have all locations for all dates.

 

This you should left join with your dataset, thereby introducting NULLs into your dataset.

Then you can try using the DAX that @Samarth_18  gave you

 

Regards,

Anonymous
Not applicable

Hi @Thejeswar

 

That is what I ideally wanted, to transform the source data so that it would include null values where there were no values recorded. I am just starting to get experience with DAX and Power Query, so I am not sure how I would go about doing that. Would I create this new table under Modeling? I've been manually extracting tables from the visuals to use as source data that helps me manipulate the output but it's very a inefficient method. 

Hi @Anonymous ,

You can use a CROSSJOIN() DAX to get this

new_table = CROSSJOIN(VALUES(Table1[Column1]),VALUES(Table1[Column2]))

The Above DAX function can be used in the Data section of the Power BI Desktop.

The Above DAX will crossjoin Column1 with Column2.

For example, if Column1 has 3 records and Column2 has 2 records, then your new_table will have totally 6 records (3  * 2)

 

Try it out in your case 

new_table = CROSSJOIN(VALUES(Table1[Dates]),VALUES(Table1[Location]))

 

Regards,

@Anonymous , In this case you could use below formula. 

Measure = calculate(count(table[name]))+0

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Anonymous
Not applicable

Hi @Samarth_18 

 

I tried that measure but this was my output: 

 

etijerina_0-1650468332639.png

Edit: This works! I will just change the name of the Measure Column, thank you! 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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