Forum Discussion

dw700d's avatar
dw700d
Post Patron
4 years ago
Solved

Calculate Sum FILTER

I am trying to create a measure that gives me the total sum  when the Tract column is blank, the Loc Cd begins with Z and the AMT column is greater than 0.   In the sample below, the total sum shou...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi dw700d ,

     

    Check the measures.

    Include<0:

    Measure = CALCULATE(SUM('Table'[AMT]),FILTER(ALLSELECTED('Table'),'Table'[Tract]=BLANK()&&'Table'[loc Cd]=SELECTEDVALUE('Table'[loc Cd])&&LEFT(SELECTEDVALUE('Table'[loc Cd]),1)="Z"))

    Aggregate value>0:

    Measure 2 = 
    var flag = CALCULATE(SUM('Table'[AMT]),FILTER(ALLSELECTED('Table'),'Table'[Tract]=BLANK()&&'Table'[loc Cd]=SELECTEDVALUE('Table'[loc Cd])&&LEFT(SELECTEDVALUE('Table'[loc Cd]),1)="Z"))
    return
    IF(flag>0,flag,BLANK())

     

    Best Regards,

    Jay