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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
DIFF1
Helper II
Helper II

Can you help me understand the formula?

 

 Hello, 

 

I have a DAX calculation that I cannot fully understand. Here is the formula

 

Does that mean if a result is less than 0 then (1 - (ABSTOERROR / TOTHIST), then it is 0, else the same calculation  (1 - (ABSTOERROR / TOTHIST) ?

 

Does that mean if we have a negative number we get 0s?

 

DIFF1_0-1644503273459.png

 

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

Correct, basically, if TOTHIST < ABSTOERROR you will get a number > 1.  When you subtract that from 1 you will get a negative which the formula will return as 0.

View solution in original post

2 REPLIES 2
jdbuchanan71
Super User
Super User

You could rewrite it like this, might make it more clear what is happening.

FA % =
VAR _Abs =
    SUM ( 'FCSTPERFSTATIC_Chain'[ABSTOTERROR] )
VAR _Hist =
    SUM ( 'FCSTPERFSTATIC_Chain'[TOTHIST] )
RETURN
    IF ( _Hist < _Abs, 0, 1 - DIVIDE ( _Abs, _Hist ) )
jdbuchanan71
Super User
Super User

Correct, basically, if TOTHIST < ABSTOERROR you will get a number > 1.  When you subtract that from 1 you will get a negative which the formula will return as 0.

Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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