Forum Discussion
mariomyhanh
3 years agoHelper I
Dax if/then divide statement
Please help, i'm fairly new to DAX and I am trying create a measure to look at a column ([Level 2]) in a table ('COA Structure') that contains "Total Operating Expense" then apply this division formu...
- 3 years ago
mariomyhanh
Please try= VAR Result = DIVIDE ( [Variance], [Budgets] ) RETURN SWITCH ( SELECTEDVALUE ( 'COA Structure'[Level 2] ), "Total Operating Expense", IFERROR ( - Result, -1 ), "Total Operating Revenue", IFERROR ( Result, 1 ), Result )
mariomyhanh
3 years agoHelper I
HI Tamerj1 total should be 2.5%. but currently it's sum it to -0.68%
| Budget | Variance | %Variance | |
| revnue | 3,600,000 | (116,000) | -3.2% |
| expense | 147,000,000 | 3,700,000 | 2.5% |
| total | (143,400,000) | 3,584,000 | -2.5% |
tamerj1
3 years agoCommunity Champion
mariomyhanh
Please try
=
VAR Result =
DIVIDE ( [Variance], [Budgets] )
RETURN
SWITCH (
SELECTEDVALUE ( 'COA Structure'[Level 2] ),
"Total Operating Expense", IFERROR ( - Result, -1 ),
"Total Operating Revenue", IFERROR ( Result, 1 ),
Result
)- mariomyhanh3 years agoHelper I
Thank you so much for all your help. Happy holidays.