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
PowerBI_User20
Frequent Visitor

Shows a 0 in the chart instead of removing dates

Hi guys,

 

I have the following chart:

PowerBI_User20_0-1650443024919.png

 

If there is no sales for vendor 3 in 2019 (as you can see in the following example) Power BI removes the value from the chart, how can I keep the information in the chart with a 0 value?

PowerBI_User20_1-1650443074316.png

 

Is there any option in the chart instead of creating new measures?

 

Thanks in advance.

 

Regards.

 

 

 

1 ACCEPTED SOLUTION
PC2790
Community Champion
Community Champion

If you are using a measure try adding 0 to your measure,example:

TotalSum = sum(ColumnName)+0

This might have performance implications if your data is huge

 

You can consider using the Count aggregation in the visualisation window and then click on the dropdown of the field in that particular visual and select "Show items with no data"

View solution in original post

16 REPLIES 16
PC2790
Community Champion
Community Champion

If you are using a measure try adding 0 to your measure,example:

TotalSum = sum(ColumnName)+0

This might have performance implications if your data is huge

 

You can consider using the Count aggregation in the visualisation window and then click on the dropdown of the field in that particular visual and select "Show items with no data"

Hi @PC2790,

 

Thank you for your help. 

 

This works for a chart but not for a table, do you know how to do the same in a table?

 

Thanks in advance.

Hi @PowerBI_User20 

For a table you can wrap your measure in an IF statement to show a 0 if the value has no data returned in the measure. 
Or if you are not using Explicit measures (just dragging and dropping a column into a visual - Implicit measure - and choosing how it is show e.g. Sum, Count, Min etc. ) then consider writing a measure for use in the visualisation. 

Hi @DemoFour,

 

Thank you for your answer, is there a way easier than using switch measure?

 

I have tried the following one but it doesn't work:

 

Calculate = if(sum(T_Sales[Sale])=0;0;sum(T_Sales[Sale]))
 
The table I have is a Percent of Total Column of the measure Calculate
 
Thanks in advance.

Hay @PowerBI_User20  

 

Without seeing your model etc. I can guide you to how I have done this, but I may need specifics to suit your current use. 

I have used the following code to show a 0 if the measure is blank

 

IF(
ISBLANK( [Measure] ),
0,
[Measure]
)

 

 

By wrapping your measure in this statement, you will return a 0 when the measure has no value, but return the measure if not. 

You can also set this up with Variables if you want to do other calculations to return:

 

 

HLD At Risk Total = 
VAR Total = 
CALCULATE(
    [Total HLD], -- This is a measaure to sum the column
    'HLD'[HLD Progress] = "At Risk"
)
VAR Result = 
IF( 
    ISBLANK( Total ),
    0,
    Total
)
RETURN
    Result

 

 

I hope this helps to guide you to a solution that works. 

Hi @DemoFour,

 

Thank you for your answer.

 

Your solution works if I select the measure with no calculation, as you can see:

PowerBI_User20_0-1650454021610.png

 

But if I show the measure as Percentage of Column Total it doesn't work (and I need to show it on this way)

 

PowerBI_User20_1-1650454063896.png

 

 

@PowerBI_User20 

Are you writing a measure to work out the % Total ?

or

Choosing to show the measure as a % of total column, in the UI of the matrix visual?

This is where writing explicit measures, is the key to showing the values you want. That way the IF ISBLANK function can still work to show the measures with 0%. 

To understand more of this within your model, it will help to share a pbix file or some dummy data to test out solutions within. 

I hope this helps you on your way to a better solution. 

Hi @DemoFour,

 

I have created a sample data.

 

The link to download it is: https://www.dropbox.com/s/983l8nd2mci9z3x/Prueba.pbix?dl=0

 

As you can see with this, if you go to the page 'Operaciones países' and select a country (it is called País in spanish) such as Costa Rica, you will see how the chart keep the format but not the tables below.

Hi @PowerBI_User20  Sorry for the delay, busy day! 

 

I have had a look at your test report, and I am not sure what you are trying to achieve.  

Do you want the table to show 0 for years with no sales e.g. Portugal which shows values in the matrix for 2021 & 22 but not for 2019 & 20? 

Can you please elaborate further on the expected output? 

Have you also considered having a hover over tool tip for the matrix; when you move the mouse over a Country, to show what you want? Rather than both graph and matrix, on the same pane.

 

Hi @DemoFour,

 

Don't worry. I want that the columns and rows without data shows 0% value, but actually it dissapears.

 

Now if I select Portugal for example I obtain this in the table:

PowerBI_User20_0-1650556951516.png

 

I would like to obtain this one:

 

PowerBI_User20_1-1650557001630.png

 

 

 

@PowerBI_User20 

If you don't want the graph or the slicer to filter the matrix, you can edit the interactions on the Format Tab. Change how visuals interact in a report - Power BI | Microsoft Docs

 

This way you can set the page up to interact how you want it to, rather than all visuals being dynamic from clicking the visuals. 

I need that the slicer filter the matrix, because if I select Portugal the value of the rest of countries/regions should be 0.

 

I just want that the another values shows value 0 or nothing but that they don't dissapear

Morning @PowerBI_User20 

I have had a look at the report and I am still not sure what your output is, as the filter context would mean that the slicer selection would show the values in the slicer. 

I have duplicated the page in your report and I think this is what you require. I cant share a link back as my org blocks this, so if you are happy to PM a email I can send this to you? 

Hi @DemoFour,

 

Of course, let me check it and and I will tell you if that is what I am looking for.

 

You can send that to me to tresmandiles1@hotmail.es

 

Thank you in advance.

 

Regards.

@PowerBI_User20 

No worries, sent via email. 

I have choosen to show the measure as a % of total column in the matrix visual.

 

I am trying to prepare a pbix file with dummy data to test it but it doesn't work as I expected. I will let you know when I share it.

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.