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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
HamidBee
Impactful Individual
Impactful Individual

Missing Percentage values

I created a chart which shows the percentage difference over months. If the base value is zero then it doesn't show any value. I'm really nor sure what I'm misisng here. Please see below:

 

Percentage Error.png

I used one of the quick measures:

 

PD.Mixed =
VAR __BASELINE_VALUE = SUM('2020'[Mixed])
VAR __VALUE_TO_COMPARE = SUM('2021'[Mixed])
RETURN
    IF(
        NOT ISBLANK(__VALUE_TO_COMPARE),
        DIVIDE(__VALUE_TO_COMPARE - __BASELINE_VALUE, __BASELINE_VALUE)
    )
 
Any help is appreciated.
 
Thank you.
1 ACCEPTED SOLUTION

Hi, @HamidBee 

 

I made a mistake in the code, I have modified '__BASELINE_VALUE' to '__VALUE_TO_COMPARE'. You can check it.

I respect your decision, if you change your mind and have other problems, you can feel free to ask me. And 

If my post helps, please consider Accept it as the solution to help the other members find it more quickly. Thank you.
 
Best Regards,
Community Support Team _ Janey

View solution in original post

10 REPLIES 10
v-janeyg-msft
Community Support
Community Support

Hi, @HamidBee 

 

As long as there is a 0 in the divisor or dividend, the result is 0. So what's your confusion?

vjaneygmsft_0-1640746254316.png

I downloaded your sample and found no problems. Is this(create a column:[A]-[B]) what you want?

If not, What's your desired result?

vjaneygmsft_2-1640746928473.png

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.
 
Best Regards,
Community Support Team _ Janey

 

Thank you. I would like it to display the percentage increase even if the base value is zero. For example in April it went from 0  to 21 but it doesn't calculate a percentage increase. 

Hi, @HamidBee 

 

vjaneygmsft_0-1641454694953.png

vjaneygmsft_1-1641454881944.png

vjaneygmsft_2-1641454911744.png

You haven't replied to me, I don't know if your problem has been solved. 

I asked you before, not that the problem is difficult, but I don’t know what the result you want is, according to your code, logically it should be 0...

 

If your want is: when __BASELINE_VALUE is 0, the percentage increase shows __VALUE_TO_COMPARE, you can try Like this:

 

PD.Mixed =
VAR __BASELINE_VALUE =
    SUM ( '2020'[Mixed] )
VAR __VALUE_TO_COMPARE =
    SUM ( '2021'[Mixed] )
VAR percentage =
    IF (
        NOT ISBLANK ( __VALUE_TO_COMPARE ),
        DIVIDE ( __VALUE_TO_COMPARE - __BASELINE_VALUE, __BASELINE_VALUE )
    )
RETURN
    IF ( percentage = BLANK (), __VALUE_TO_COMPARE, percentage )

 

 

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.
 
Best Regards,
Community Support Team _ Janey

Apologies, I've just bene drowning with work lately. I've given it some thought and I agree with you. From a mathematical point of view their is no numerical increase if the baseline value is zero. In all of my years working with numbers this is the first time I've come across this question. I'll leave it as it is for now, unless their is a way to put "null" if the baseline value is zero.

Hi, @HamidBee 

 

I made a mistake in the code, I have modified '__BASELINE_VALUE' to '__VALUE_TO_COMPARE'. You can check it.

I respect your decision, if you change your mind and have other problems, you can feel free to ask me. And 

If my post helps, please consider Accept it as the solution to help the other members find it more quickly. Thank you.
 
Best Regards,
Community Support Team _ Janey

@HamidBee  Can you share your desired result or your calcultion logic? I don’t understand what percentage increase you said should be presented in the visual.

amitchandak
Super User
Super User

@HamidBee , Mark it as %, from measure tools (Click on the measure you will see that). Also, use bar and line visual with secondary axis enabled

https://docs.microsoft.com/en-us/power-bi/visuals/power-bi-visualization-combo-chart

Are you referring to this as it seems it was already on percent:

 

percent.png

It seems it hasn't resolved the issue:

 

Percentage Error.png

Also, is this what you mean by bar and line visual:

 

Bar&Line.png

 

@HamidBee , I meant line and clustered column visual.

 

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Hi

 

I am attaching a saple pbix file which mimicks the same problem.

 

https://www.mediafire.com/file/nkqwwlutrgwn5e8/Percentage+Problem.pbix/file

 

Thank you,

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.