Forum Discussion
NilR
5 years agoPost Patron
Measure in If statement returns incorrect total
I am new in PBI and desperately need help. I have a summarized table and the end result is the last column ( had_well) in the picture, but returns the wrong total which is the first column total. I u...
- 5 years ago
I changed the calculation and worked.
ADDCOLUMNS( SUMMARIZE( ''AW'', ''AW''[ID],''AW''[M18], "MAXID", CALCULATE(DISTINCTCOUNT(''AW''[ID]), ALLEXCEPT(''AW'',''AW''[ID]),''AW''[DATE]=_maxdate) ),"YR1", [YR1_HAD_WELL],"YR2", [YR2_HAD_WELL],"TTL_MO", [TTL_MO],"HAD_WELL",IF([M18]="YES" ,[YR2],[YR1])) Return SUMX(FILTER(__tmpTable,[MAXID]=1),[HAD_WELL])
NilR
5 years agoPost Patron
I changed the calculation and worked.
ADDCOLUMNS(
SUMMARIZE(
''AW'',
''AW''[ID],''AW''[M18],
"MAXID", CALCULATE(DISTINCTCOUNT(''AW''[ID]), ALLEXCEPT(''AW'',''AW''[ID]),''AW''[DATE]=_maxdate)
),"YR1", [YR1_HAD_WELL],"YR2", [YR2_HAD_WELL],"TTL_MO", [TTL_MO],"HAD_WELL",IF([M18]="YES" ,[YR2],[YR1]))
Return
SUMX(FILTER(__tmpTable,[MAXID]=1),[HAD_WELL])