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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
erikbeauch
Frequent Visitor

Multiplying two measures and losing all decimals

Hi, in the example below, I have measures from a transaction history table.
Quantity is the sum of all share quantities in the history table. 
Avg price is the sum of all costs (Quantity * Paid price per share in a calculated column of this history table), divided by the the total quantity.

Both of them are accurate in the example:

erikbeauch_2-1723049514927.png

 

The problem is measuring the Total Cost. When I multiply the Quantity measure (2116) with the AvgPrice measure (30.68384): the total should be 64927.0054, but all decimals are showing as zero. I made sure all data types are set as decimals in Power BI (eg no currencies), for all fields and measures, it makes no difference. I tried applying a Round function to 5 decimals on all measures and fields, makes no difference. Tried using Fixed Decimals, it does not work either. In the source Excel file, and Power Query import, the data type is Number. 

What else can I try? Thanks for your help!

Note: the problem appears to be with the AvgPrice measure, because if I calculate the total cost by using the Quantity measure * harcoded value "30.68384", the result is ok.




1 ACCEPTED SOLUTION
erikbeauch
Frequent Visitor

It actually started working by rounding the two sub measures like this:

Mes_AvgPrice = ROUND([Mes_Cost]/[Mes_Qty],5)

View solution in original post

5 REPLIES 5
erikbeauch
Frequent Visitor

It actually started working by rounding the two sub measures like this:

Mes_AvgPrice = ROUND([Mes_Cost]/[Mes_Qty],5)
NaveenGandhi
Super User
Super User

Hi @erikbeauch 

Just wanted to check if you tried changing the source excel and PQ data types to decimal or fixed decimal?

Regards,
NG

Hi Naveen, in PQ, it's changing the types like this:
type number
Should it be set differently?

@erikbeauch 

Type number is the correct data type, Check the below article if it helps in any way.

Also can you share sample file by removing sensitive data to understand whats the issue.

https://www.sqlbi.com/articles/rounding-errors-with-different-data-types-in-dax/

Thanks,
NG

Can you share a sample file by removing sensitive data

Thanks Naveen. Sent you a download link to a sample file with 8 transactions. Thanks for the page, still trying to digest it. Since everything is set as decimal I don't understand yet why the product does not keep those decimals.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors