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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
Debsidrian
Frequent Visitor

HELP with DAX (Conditional Measure)!!!!

I want to create a column with a calculated value:

If the Value in "sum of fines" is < average fines, return (Average fines - sum fines) if not return "sum of fines"

 

I am using this DAX: 

 
ConditionalValue =
IF(
    SELECTEDVALUE(Record[fines])
    <[TotalAvg],
    [TotalAvg]-([fines average per dc_nbr]),
  SELECTEDVALUE(Record[fines])) 
 
TotalAvg = CALCULATE([fines average per dc_nbr],ALL('Record'[dc_nbr]))
 
but is not returning the value when is Fines>average
Debsidrian_0-1717712148992.png

 

 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Debsidrian ,

 

I’d like to acknowledge the valuable input provided by the @vicky_ . Their initial ideas were instrumental in guiding my approach. However, I noticed that further details were needed to fully understand the issue. 

 

You can try this.

ConditionalValue =
IF(
    SUM(Record[fines])
    <[TotalAvg],
    [TotalAvg]-([fines average per dc_nbr]),
  SUM(Record[fines])) 

 

More detailed information can be found in the pbix attachment.

vkaiyuemsft_0-1718007945806.png

 

Best Regards,

Clara Gong

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

3 REPLIES 3
Anonymous
Not applicable

Hi @Debsidrian ,

 

I’d like to acknowledge the valuable input provided by the @vicky_ . Their initial ideas were instrumental in guiding my approach. However, I noticed that further details were needed to fully understand the issue. 

 

You can try this.

ConditionalValue =
IF(
    SUM(Record[fines])
    <[TotalAvg],
    [TotalAvg]-([fines average per dc_nbr]),
  SUM(Record[fines])) 

 

More detailed information can be found in the pbix attachment.

vkaiyuemsft_0-1718007945806.png

 

Best Regards,

Clara Gong

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

vicky_
Super User
Super User

The issue might be in the 1st part of your DAX:

ConditionalValue =
IF(
    SELECTEDVALUE(Record[fines]) ... // is this supposed to be SUM?

I think what's happening is that the SELECTEDVALUE() can't find a single value of [fines] per dc_nbr value, so it will return BLANK. The docs for the function (https://learn.microsoft.com/en-us/dax/selectedvalue-function-dax) says that it will only return one distinct value, otherwise it will return an alternative value, which defaults to blank (and will be less than whatever [TotalAvg] you have). As a result, the second condition never evaluates.

yes is supposded to be a SUM

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.