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

Adding two measures within an IF statement

Help! I'm trying to create a calculated column using an IF statement and need to add together 2 measures and compare the points value. Both measures are based on the "Points" column. The standard deviation is 12.5 and the average is 25.7 so together, they should equal 38.2. Since some of the point values are greater than 38.2, I would expect those values to have a Tier of "S" but instead, it is showing V for all of them. What am I doing wrong? 

 

Measure.PNG

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

The standard deviation and average measures are being computed in the current row context, they are not being computed against the whole dataset.

You'll need something like

 

Tier =
VAR _stdDev =
    CALCULATE ( [Standard deviation], ALL () )
VAR _avg =
    CALCULATE ( [Average], ALL () )
RETURN
    IF ( 'ASG Contribution Points'[Points] > ( _stdDev + _avg ), "S", "V" )

 

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Measure.PNG

Looks like stdDev and avg are reserved words in DAX, even though they're not function names. Just put an _ before them. I'll edit my original post to include that

Anonymous
Not applicable

that worked, thank you! 

johnt75
Super User
Super User

The standard deviation and average measures are being computed in the current row context, they are not being computed against the whole dataset.

You'll need something like

 

Tier =
VAR _stdDev =
    CALCULATE ( [Standard deviation], ALL () )
VAR _avg =
    CALCULATE ( [Average], ALL () )
RETURN
    IF ( 'ASG Contribution Points'[Points] > ( _stdDev + _avg ), "S", "V" )

 

Anonymous
Not applicable

I tried exactly that and am recieving this error:

 

The syntax for 'stdDev' is incorrect. (DAX(VAR stdDev = CALCULATE('ASG Contribution Points'[Standard Deviation], ALL())VAR avg = CALCULATE('ASG Contribution Points'[Average],ALL())RETURN IF ('ASG Contribution Points'[Points] > (stdDev + avg), "S", "V"))).

can you post a screenshot of the measure definition you are using?

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

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.