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
thavidu
New Member

Force decimal instead of integer

I've been both trying and searching for hours, but I can't seem to figure out how to make my measure return a decimal number instead of an integer. In both Card and Table views, its only returning whole numbers (0.3 => 0 and 1.6 => 2)

 

My measure is using the / divide operator which should result in a decimal but its only returning an int, and no casting function appears to be available when I'm looking..

 

My measure looks like "Store Coverage = inventory_waypoint[Waypoints Captured Today] / inventory_waypoint[Enabled_Waypoints]"

And those two are actually measures themselves

Waypoints Captured Today = SUM(inventory_waypoint[Captured_Today])*1.0 

(I tried adding the 1.0* to see if that would make it into a float but no luck..)

Enabled_Waypoints = CALCULATE(count(inventory_waypoint[id]), ALLEXCEPT(inventory_waypoint, inventory_waypoint[enabled]))

And those are based on some calculated columns (the rest are real columns)

Captured_Today = If(inventory_waypoint[DaysOldC]<=1, 1, 0)

and

DaysOldC = Day(NOW() - 7/24) - Day(inventory_waypoint[last_captured])

 

I tried to see if there might be some way to edit in the query editor window but didn't see anything there either (especially since these calculated columns/measures don't even show up there). I'm new to PowerBI so any help is very appreciated 😃

1 ACCEPTED SOLUTION

@thavidu

 

Store Coverage = 10/3  should be a decimal number already.

 

In your screenshot, underneath "Decimal Number", Decimal Places is set to zero. Increasing that should increase the number of decimal places displayed for that measure.

 

In general, when calculating INTEGER / INTEGER, Power BI should convert both numerator and denominator to REAL before performing the calculation (according to this page).


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

View solution in original post

8 REPLIES 8
Greg_Deckler
Super User
Super User

In the data model, select your measure. Click "Modeling" tab. Click the drop down for Data Type in the ribbon and switch it to "Decimal Number". Should default to 2 decimal places but you can control that as well.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

DataType isn't enabled as an option, only Format (which I just changed to "Decimal Number" and it had no effect). I see the DataType option on calculated columns, but not on measures.

To simplify the problem, I created a measure as this:

 

Store Coverage = 10/3

Which displays value 3 on my table and card, even though I've selected "Decimal Number" as the format in the ribbon above.

Screenshot is attached for reference-- any ideas? 😃

 

 

store_coverage.PNG

@thavidu

 

Store Coverage = 10/3  should be a decimal number already.

 

In your screenshot, underneath "Decimal Number", Decimal Places is set to zero. Increasing that should increase the number of decimal places displayed for that measure.

 

In general, when calculating INTEGER / INTEGER, Power BI should convert both numerator and denominator to REAL before performing the calculation (according to this page).


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

Hi,

 

The option to increase decimal number for POWER BI Desktop isn't available.

Any other tips of how to increase decimal numbers?

 

I need numbers to appear as 3 decimal. Example: 0,121

In the data model, is the Data Type "Decimal Number"? Also, is the Format set to "Decimal Number"?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi,

 

There is no option to add decimal... I need 3 but appears only two.

Know when you pass the mouse in the chart and the values appears? In this box, always appears with only 2 decimal, and I need 3...

 

I'm trying to add my print screen here but it's not possible...

 

Thank you!

 

You mean this is not possible?

 

decimals.pngdecimals1.png


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thanks guys!! That did the trick.

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.