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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Anonymous
Not applicable

Creating a measure combining percentage and free text

 

Hi there

 

I want to create a measure that calculates a percentage and includes text. I have created the below code but the percentage appears as 3.5715518772422e-02.

When I isolate the percentage calculation without the text, it appears correctly as 3.57%

 

Is there anything I can do to display the percentage correctly?Percentage Sample.png 

Measure = "Map represents "&
DIVIDE(
CALCULATE(
COUNTROWS(Dataset'),
FILTER('Dataset','Dataset'[Country of Residence]<>"")),
COUNTROWS('Dataset'))
&"% of Live users"

Thanks,
Jemma

1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

Hey,

 

for similar requirements I use FORMAT to shape the value to my accordance like so

_test measure = 
var selectedrows = COUNTROWS('Fact Sale open')
var allrows = CALCULATE(COUNTROWS('Fact Sale open') , ALL('Dimension City'[Sales Territory])) 
return
"the share of the selected territories is " &
FORMAT(DIVIDE(selectedrows , allrows , BLANK()) * 100 , "#.000000") & "%"

This looks on a Card visual like this:

image.png

Hopefully this is something you are looking for.

 

Regards,

Tom

 

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

3 REPLIES 3
TomMartens
Super User
Super User

Hey,

 

for similar requirements I use FORMAT to shape the value to my accordance like so

_test measure = 
var selectedrows = COUNTROWS('Fact Sale open')
var allrows = CALCULATE(COUNTROWS('Fact Sale open') , ALL('Dimension City'[Sales Territory])) 
return
"the share of the selected territories is " &
FORMAT(DIVIDE(selectedrows , allrows , BLANK()) * 100 , "#.000000") & "%"

This looks on a Card visual like this:

image.png

Hopefully this is something you are looking for.

 

Regards,

Tom

 

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
Anonymous
Not applicable

Perfect @TomMartens  I changed your measure to the below and I get 3.5% which is perfect. 

 

Country of Residence % = 
"Map represents "&FORMAT(DIVIDE(
    CALCULATE(
        COUNTROWS('Dataset'),
        FILTER('Dataset','Dataset'[Country of Residence]<>"")),
        COUNTROWS('Dataset'))*100,"#0.0")&" % of Live users"
Anonymous
Not applicable

Perfect @TomMartens  I changed your measure to the below and I get 3.5% which is perfect. 

 

Country of Residence % = 
"Map represents "&FORMAT(DIVIDE(
    CALCULATE(
        COUNTROWS('Dataset'),
        FILTER('Dataset','Dataset'[Country of Residence]<>"")),
        COUNTROWS('Dataset'))*100,"#0.0")&" % of Live users"

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.