Forum Discussion
NilR
Post Patron
5 years agoMeasure 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])
parry2k
Super User
5 years agoNilR try something like this
Measure =
SUMX ( vALUES ( Table[Id] ),
IF(SELECTEDVALUE('0410 Adult Wellness'[MALE_18-34]) = "YES" , __tmpYR2, __tmpYR1)
)
Check my latest blog post Year-2020, Pandemic, Power BI and Beyond to get a summary of my favourite Power BI feature releases in 2020
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡