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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
astrbac
Frequent Visitor

Combination Value.Divide() and Value.Add() returns all null results?

Hello,

 

as I came to grasp with M language basics, a strange problem started bugging me. Creating a simple custom column by adding two and dividing them by third.

 

This is what I usually do:

 

1. "Get&Transform" data from a .csv;

2. I sort my columns (fields);

3. I then add a few custom columns, usually very simply like [Column2] / [Column1];

4. I then tried this column which started making trouble:

 

= ([Website conversions value] + [#"Mobile app purchases value (corrected)"]) / [#"Amount spent (GBP)"]

This failed miserably. Returned a whole field of null values.

I triple checked - all three fields that I use in the formula have values.

 

I then learned a bit of M and tried this:

 

= Value.Divide( Value.Add( [Website conversions value], [#"Mobile app purchases value"]), [#"Amount spent (GBP)"])

Also no luck, all null values. Any idea what might be wrong?

 

Thanks all in advance!
Alex

 

3 REPLIES 3
v-yuta-msft
Community Support
Community Support

Hi astrbac,

 

What's your data type? Could you show some sample data?

 

Regards,

Jimmy Tao

Hi guys!

 

I don't even know how to share this dataset both with the model, except to share the real WOrkbook. I can't do that because there is client data in it.

 

If you mean "are the fields that I am adding and then dividing of the proper data type" BEFORE I use them in my calculation - the answer is yes.

 

- [Website purchases value] is imported from .csv and properly declared (automatically) as 1.2 (decimal number);

[Mobile purchases value] is imported from .csv and properly declared (automatically) as 1.2 (decimal number);

 

My first calculation of correcting [Mobile purchases value] works.

 

= if List.Contains({"iPhone", "iPad", "iPod"}, [Impression Device]) then ([Mobile app purchases conversion value]/2) else [Mobile app purchases conversion value]

After this step, I change the type of this new column to decimal number.

 

Now I try to use this new column in the second calculation, as in my post above, both of the fields in question have been declared as decimal number, and it simply does not work.

 

 

rafaelmpsantos
Responsive Resident
Responsive Resident

Before thi check if all the columns is type as number. (in the column head you may see something like 123 or 1.2)

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.