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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Error on Subtracting two measures having format

Hi @PaulDBrown  and @all,

Here is one more Issue i am facing. I think you can fix this. 
Continuing to the link below.
https://community.powerbi.com/t5/Desktop/sign-currency-for-only-few-rows-based-upon-condition/m-p/94...

 

I have subtracted two measures and applied in matrix which gives me an error as shown in the screenshot.
Change = [January] - [February]

changeerror.JPG

 

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

We can try to use the following measure to meet your requirement:

 

Change =
VALUE (
    SUBSTITUTE (
        [January Total] & "",
        "$",
        ""
    )
)
    - VALUE (
        SUBSTITUTE (
            [February Total] & "",
            "$",
            ""
        )
    )

 

If it does not work, could you please share the formula of [Janury Total] and [February Total] if it does not contain any confidential information?


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

13 REPLIES 13
PaulDBrown
Community Champion
Community Champion

@Anonymous 

 

Make sure that all columns and measures used in the calculations are formatted as some sort of number (not "general" nor "text" etc..)





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Anonymous
Not applicable

Thanks for reply @PaulDBrown 

The calculation used for Change are measures [January Total] and [February Total] which have the same data type as shown in below screenshot.
january.JPG

 Change = [January Total] - [February Total] 

Still results in same error.  Is there any thing else I am missing ?

@Anonymous 

Try changing the "Data Type: variant" to decimal number.

january.JPG

 

If you can't do it in the measure formatting options, make sure your columns you are refrencing in the measures for the calculations are formatted as decimal numbers.

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Anonymous
Not applicable

Hi @PaulDBrown ,

Unable to change the data type from Variant as few are having $ format and few don't. I have checked from lowest calculating columns and measures. I have changed them from General to Decimal Number still its the same error. 

i think some of the columns you use to calculate january total or february total is txt or some are date and other numeric. 

Anonymous
Not applicable

Hi @santiagomur ,

Thanks for reply. I have checked with calculating columns and measures. All of them are set to Decimal Number.

@Anonymous 

 

Are you using the function FORMAT in any of the columns or measures?

The error you are getting is saying that somewhere along the calculation line you have a non-number value(s)





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Anonymous
Not applicable

January and February measures have both have format @PaulDBrown 

@Anonymous 

by "format" do you mean you are using the Function FORMAT( ) ?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Anonymous
Not applicable

yes @PaulDBrown 

Hi @Anonymous ,

 

We can try to use the following measure to meet your requirement:

 

Change =
VALUE (
    SUBSTITUTE (
        [January Total] & "",
        "$",
        ""
    )
)
    - VALUE (
        SUBSTITUTE (
            [February Total] & "",
            "$",
            ""
        )
    )

 

If it does not work, could you please share the formula of [Janury Total] and [February Total] if it does not contain any confidential information?


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi,

 

Please try to apply the FORMAT function for the whole arithmetic operation and not for each measure.

so basicaly, FORMAT([January]-[February],....)

try use Jantotal=values(column)   FebTot=Values(column)       dif=[JanTotal]-[FebTotal]

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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