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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Infinity values in calculated column without any division with zero - How to correct?

Hi! I am trying to create a calculated column by dividing 2 values as below:

 

Market value of stock/portfolio value (a calculated field)

 

I am getting infinity values for above even though portfolio value is a single decimal number. If I replace portfolio value with a fixed number (e.g. 1400000), the calculation works and there are no infinity values. 

 

Please help me in getting rid of the infinity without hard coding the portfolio value.

 

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

That’s weird. Even with the sample data from you, I can’t repro this issue as well.

Portfolio value Table

vcazhengmsft_0-1650264995863.png

 

Stocks Table

vcazhengmsft_1-1650264995866.png

 

No relationship between these two tables

vcazhengmsft_2-1650264995868.png

 

Calculations:

1 Portfolio value (Measure)

 

Portfolio value = CALCULATE(SUM('Portfolio value'[Value]),FILTER('Portfolio value', 'Portfolio value'[Holding type] <> "Liabilities"))

 

 

2 Stock Yield (Calculated column)

 

Stock Yield = DIVIDE(Stocks[Market Value],[Portfolio value])*Stocks[Gross indicative div yield]

 

 

Drag Stock Yield to clustered column chart, it looks like this.

vcazhengmsft_3-1650264995869.png

 

Could you please drag and drop "Portfolio value" Measure to a table visual to check whether it has correctly calculated the result? In addition, please check if this issue is caused by improper data type or filters in the report. Thanks in advance!

vcazhengmsft_4-1650264995873.png

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

View solution in original post

14 REPLIES 14
v-cazheng-msft
Community Support
Community Support

Hi @Anonymous ,

 

May I know whether your issue has been resolved? If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. Thank you very much!

 

Best Regards,

Community Support Team _ Caiyun

Anonymous
Not applicable

Thank you for your response. 

Portfolio value table
Holding typeValue
Cash37234
Cash8249
Cash98436
Fixed income109175
Fixed income139776
Fixed income170377
Fixed income200978
Alternatives9482
Alternatives262180
Alternatives292781
Equity323382
Equity353983
Equity49244
Liabilities58275
Liabilities94750
Liabilities131225
Liabilities167700

 

Portfolio value (calculated field) = sum of all values, condition (holding type <> Liabilities)

 

Stocks Table
Stock Market ValueGross indicative div yield
ISRG1002.56
PANW403.9
SHOP5012.7
UPST2010
PYPL7014.97
AAPL14018.02

 

Stock Yield (Calculated column) = Market value / Portfolio value * Gross indicative dividend yield

 

Problem: Stock yield has infinity values even though there is no division by 0 (Portfolio value is a decimal number). If I manually input a fixed number, the caculation works

Hi @Anonymous ,

 

That’s weird. Even with the sample data from you, I can’t repro this issue as well.

Portfolio value Table

vcazhengmsft_0-1650264995863.png

 

Stocks Table

vcazhengmsft_1-1650264995866.png

 

No relationship between these two tables

vcazhengmsft_2-1650264995868.png

 

Calculations:

1 Portfolio value (Measure)

 

Portfolio value = CALCULATE(SUM('Portfolio value'[Value]),FILTER('Portfolio value', 'Portfolio value'[Holding type] <> "Liabilities"))

 

 

2 Stock Yield (Calculated column)

 

Stock Yield = DIVIDE(Stocks[Market Value],[Portfolio value])*Stocks[Gross indicative div yield]

 

 

Drag Stock Yield to clustered column chart, it looks like this.

vcazhengmsft_3-1650264995869.png

 

Could you please drag and drop "Portfolio value" Measure to a table visual to check whether it has correctly calculated the result? In addition, please check if this issue is caused by improper data type or filters in the report. Thanks in advance!

vcazhengmsft_4-1650264995873.png

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

v-cazheng-msft
Community Support
Community Support

Hi @Anonymous ,

 

May I know whether your issue has been resolved? If you still have problem on it, could you please provide some sample data from your tables and tell me the relationships between them so I can help you find the solution?

Based on the info from you, I create some sample data to do the same calculation as you. But I don’t get the problem. So I guess it maybe something related to the data in the fields or the relationships.

vcazhengmsft_0-1649915992639.png

 

vcazhengmsft_1-1649915992641.png

 

vcazhengmsft_2-1649915992642.png

 

vcazhengmsft_3-1649915992644.png

 

Best Regards,

Community Support Team _ Caiyun

Anonymous
Not applicable

division with calculated fielddivision with calculated fielddivision with fixed numberdivision with fixed number

Anonymous
Not applicable

the problem seems to be with the portfolio value calculated field because if I replace portfolio value with some other calculated field, it works. However, I have thoroughly check portfolio value for any errors or 0s and there's none.

Anonymous
Not applicable

Is the Portfolio value a calculated measure or a calculated column?

Anonymous
Not applicable

it is a measure

Anonymous
Not applicable

Try creating a calculated column with just this measure. 
Like
Test Portfolio Value = [Portfolio Value]
and see what results you are getting at each row

Anonymous
Not applicable

tried this as well. It treats the portfolio value column the same way as the measure. Basically, no difference in output

Anonymous
Not applicable

Thank you for your response! 

 

Unfortunately, I have already tried using Divide and it just makes all values "-" or "NA" in case I put these as alternative output.

Anonymous
Not applicable

It would be helpful if you can tell how you calculated the portfolio value. It can be the case where the measure is non-zero without any filter context but within the row context of the table, the value of the calculated measure is becoming zero.

Anonymous
Not applicable

Portfolio Value = CALCULATE(SUM('Asset Allocation (Static)'[Value]),'Asset Allocation (Static)'[Holding Type]<>"Liabilities")
 
here, Asset Allocation (Static) is the table name
Anonymous
Not applicable

Hi @Anonymous 
you can use the DIVIDE function to remove the infinity values. You can put a default value in case of infinity such as "-" or "NA"
syntax would be 

Result = Divide(Market value of stock,portfolio value,"NA")

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.