Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin 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.
Hello everybody,
I want to calculate the logarithm of a division (close/prev-closing). The following columns are relevant for this: Date, Close, PreviousClose, PreviousDate. The general change in % can be calculated using the formula "(Close / Prev_Closing) -1". In my case I would now like to calculate the logarithm. In Excel, the formula would be: ln(Close / Prev_Closing). The formula in Power BI "DailyChangeLN = ln (divide (Fact_Stocks [Close]; Fact_Stocks [Prev_Closing]))" unfortunately gives me ERROR with the error: 'An Argument of Function Ln has wrong data type or result is too small or too large '. Why is that?
Best regards, hwoehler
Solved! Go to Solution.
LN only working for non zero positive numbers. I checked and changed formula like this and it is working
DailyChange LN = if(Fact_Stocks[DailyChange]<>0, ln(abs(Fact_Stocks[DailyChange])))
Check file at same location
Check both are of decimal data type. Try new column like
new column = divide(table[Close] ,table[Prev_Closing]) -1
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges
Connect on Linkedin
Hi @amitchandak,
thanks for your quick reply. Unfortunately it doesn't work. Both Columns (Close and Prev_Closing) are of the decimal number data type. Maybe you have time to have a closer look at my file: https://we.tl/t-wizGGyNNix
Regards, hwoehler
I added this one and it worked
DailyChangeLN = DIVIDE(Fact_Stocks[Close],Fact_Stocks[Prev_Closing])-1
Refer :https://www.dropbox.com/s/fn97mbhbxzxzpbr/Korrelation.pbix?dl=0
Hi @amitchandak,
you're right. This is the formula, which already worked before. As i mentioned in the text ("In my case I would now like to calculate the logarithm.") i want to calculate the logarithm of the division. There is the Error.
Do you have a hint?
Regards,
LN only working for non zero positive numbers. I checked and changed formula like this and it is working
DailyChange LN = if(Fact_Stocks[DailyChange]<>0, ln(abs(Fact_Stocks[DailyChange])))
Check file at same location
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
78 | |
77 | |
59 | |
36 | |
33 |
User | Count |
---|---|
100 | |
62 | |
56 | |
48 | |
41 |