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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

I need help converting a simple Excel formula to DAX

I am currently struggling converting an excel formula to DAX format. The formula is:

 

 

=IFERROR(IF([Variance]/ABS([2021 Amount])<-10000000,-1,IF([Variance]/ABS([2021 Amount])>10000000,1,[Variance]/ABS([2021 Amount]))),0)

 

Variance and 2021 Amount are both the collumns I am calculating the data from. I am adding it as a measure in a pivot table because when I filter the pivot table I want the percentage of varance be calculated on the grand total as well rather than a sum of the percentages. Which is useless when looking at percentages.

 

Many thanks.

4 REPLIES 4
Anonymous
Not applicable

HI @Anonymous,

Any update on this? Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.

If these also don't help, please share more detailed information to help us clarify your scenario to test.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

vapid128
Solution Specialist
Solution Specialist

In dax, the formula should be all same.

All you need to do is repleace A/B to DIVIDE(A,B) 

Anonymous
Not applicable

Thank you for your contribution vapid128. I replaced the formula with the following but unfortunately it did not work.

 

IFERROR(IF(DIVIDE([Variance],ABS([2021 Amount]))<-10000000,-1,IF(DIVIDE([Variance],ABS([2021 Amount]))>10000000,1,DIVIDE([Variance],ABS([2021 Amount])))),0)

 

It is giving me the following message. 

 

"A single value for column 'Variance' in table 'Range' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.'."

I am sorry, I didn't see you want to add a measure.

 

Since [Variance] is a colnum, you need to tell dax, how it become a measure.

like Min/Max/Sum/Average.....

 

When you write "[Variance]/ABS([2021 Amount])<-10000000"

IF all in colnum or measure, it will be very clear to understand.

But if it is from colnum to measure, it is not that clear.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

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