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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
kannanAhammed
Helper IV
Helper IV

percentage in whole number

Hi,

i am converting a decimal value to percentage. please see the dax function i have used.

TimelyResponseMaterialInspections = VAR V = CALCULATE (
MAX ( 'MER'[This month] ),
FILTER (
'MER',
'MER'[Title] =="Material Inspections"
)
) Return
IF(ISBLANK(V),0,FORMAT(V,"Percent" ))
 
"MER'[This month]" will have values such as "0.775193798" once converted to percentage it will be "77.53%". i would like to remove the decimal and have the output to "77%".
 
will this be possible?
 
1 ACCEPTED SOLUTION

Hi @kannanAhammed ,

 

Try this measure and then click on the measure and then format it from the ribbon to % .

 

TimelyResponseMaterialInspections =
VAR V =
    CALCULATE (
        MAX ( 'MER'[This month] ),
        'MER'[Title] == "Material Inspections"
    )
RETURN
    IF (
        ISBLANK ( V ),
        0,
        V,
          
        )
    )

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

 

 

View solution in original post

13 REPLIES 13
V-pazhen-msft
Community Support
Community Support

@kannanAhammed

 

Generally, you need to selected the measure from the right panel and then just change the format and decimal places on the top ribbon.

format11.JPG

 


Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @kannanAhammed ,

 

Try this measure and then click on the measure and then format it from the ribbon to % .

 

TimelyResponseMaterialInspections =
VAR V =
    CALCULATE (
        MAX ( 'MER'[This month] ),
        'MER'[Title] == "Material Inspections"
    )
RETURN
    IF (
        ISBLANK ( V ),
        0,
        V,
          
        )
    )

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

 

 

Thanks @harshnathani 

harshnathani
Community Champion
Community Champion

Hi @kannanAhammed ,

 

 

TimelyResponseMaterialInspections =
VAR V =
    CALCULATE (
        MAX ( 'MER'[This month] ),
        'MER'[Title] == "Material Inspections"
    )
RETURN
    IF (
        ISBLANK ( V ),
        0,
        FORMAT (
            V,
            "Percent"
        )
    )

 

 

Percent by default will give you 2 decimal places rounding off.

 

You cna also format this measure in the ribbon above.

 

https://docs.microsoft.com/en-us/power-bi/create-reports/desktop-ribbon

 

1.jpg

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

@harshnathani thanks for the reply, but when i run the Dax function provided I get 0 as output. And the ribbon is dissabled.

kannanAhammed_0-1597776239894.png

@AllisonKennedy yes you are right, I only want the decimal gone, but if the blanks can be removed with DAX i will take that too 🙂

Hi @kannanAhammed ,

 

Select the measure in the field pane, your ribbon will be enabled.

 

1.jpg

 

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

 
 

Capture.JPG

@harshnathani
Please can you elaborate on what you changed from the original poster's measure? I would love to learn the secret, but can't spot the difference.
Thanks!

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Hi @AllisonKennedy ,

 

There was a FILTER applied to the Table, which I removed.

 

Regards,
Harsh Nathani
 
 

@harshnathani
Ah yes, thanks! I knew there was something, ok, so now comes my learning and the real question:

I know CALCULATE works with column filters and prefers them, but the FILTER function should still provide the same result as your column filter in this example? What am I missing?

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

HI @AllisonKennedy ,

 

This is what I learnt from this video by Jeffery Wang

 

https://www.youtube.com/watch?v=bJtRB86n9tk

 

Watch the section from 35 to 45 min.

 

 

Regards,

Harsh Nathani

 

 

Thanks @harshnathani for answering my silly questions, hopefully our dialogue will be helpful to someone. The video you have posted does do a nice job of explaining the differences in filter options when using CALCULATE, but I understood the question to be completely unrelated to the use of filter or calculate and more of an origin in the behaviour of FORMAT

So here is my understanding of this situation:

Using the FILTER() function inside CALCULATE (as has been done in original post) will ensure that blank values are returned for any [Title] that is not "Material Inspections"

Using MAXX(FILTER( ), Mer[Month]) will also ensure that blank values are returned for any Title that does not meet the filter conditions.

Using CALCULATE without the FILTER (so simply using BOOLEAN expression as you suggested) will return the same value of Material Inspection, even when we ask for a different Title.

If I understand the original post correctly, the question, copied below, was about number formatting, not blank values returned.

We will have to wait for @kannanAhammed to provide more clarity around the problem, but I have assumed that they are happy with the blank values (particularly as they are converted to zero within the DAX function) and only wanted help with the formatting, not in replacing those blank values with material inspections.

"MER'[This month]" will have values such as "0.775193798" once converted to percentage it will be "77.53%". i would like to remove the decimal and have the output to "77%".

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

AllisonKennedy
Super User
Super User

I would recommend keeping the measure as a number, so do NOT use the DAX FORMAT() as that converts to text

https://docs.microsoft.com/en-us/dax/format-function-dax

Instead, just use the measure formatting:
https://radacad.com/custom-format-fields-and-measures-in-power-bi

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.