Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

how to Subtract two column in the PowerBi

HI All,

Kindly help me the below issue, 

where sales1 table is merged table from verify table, So i am trying to subtract the two columns, when i am trying the below formula i have received the error

 

also i have try the below formula

[OINV.DocTotal]-[OINV.PaidToDate] its taking the text format but i try to change the data type 

 

i am getting this error. 

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi, Anonymous 

    Thanks for the reply from amitchandak , please allow me to provide addition:

    First, make sure that the columns are all numeric data types (e.g., integers, decimal numbers). You can check and change the data type by navigating to Power Query Editor, selecting the columns, and then selecting the correct data type from the drop-down list on the tab. For more details on changing the data type, please refer to the official documentation:

    Data types in Power BI Desktop - Power BI | Microsoft Learn


    After you confirm that both columns are numeric data types, you can create calculated columns for subtraction. Use the following DAX formula in the new column:

    SubtractionResult = [OINV. DocTotal] - [OINV. PaidToDate]

     

    Once you've created a calculated column, check it for any errors. If there is an error, it may be due to a null value or a blank value in the column. You may need to handle these situations in the DAX formula.

     

    How to Get Your Question Answered Quickly 

    Best Regards

    Yongkang Hua

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • Anonymous , check the datatype of the columns, Both should be number type

    OINV.DocTotal]-[OINV.PaidToDate]

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi, Anonymous 

    Thanks for the reply from amitchandak , please allow me to provide addition:

    First, make sure that the columns are all numeric data types (e.g., integers, decimal numbers). You can check and change the data type by navigating to Power Query Editor, selecting the columns, and then selecting the correct data type from the drop-down list on the tab. For more details on changing the data type, please refer to the official documentation:

    Data types in Power BI Desktop - Power BI | Microsoft Learn


    After you confirm that both columns are numeric data types, you can create calculated columns for subtraction. Use the following DAX formula in the new column:

    SubtractionResult = [OINV. DocTotal] - [OINV. PaidToDate]

     

    Once you've created a calculated column, check it for any errors. If there is an error, it may be due to a null value or a blank value in the column. You may need to handle these situations in the DAX formula.

     

    How to Get Your Question Answered Quickly 

    Best Regards

    Yongkang Hua

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.