Forum Discussion

KamilRetkiewicz's avatar
1 year ago

Conditional measure

Hi Guys,

 

I have come across a rather interesting situation. I have a table in which I have an ACCOUNT column. It is mapped with the other table (name_entity column).
In the matrix in the rows I have values from the name_entity column. I need to write a measure that conditionally, for all rows will take some there specified value, and for one particular one, say “% of Cash Invested” will take dividing values from two other rows “Total Average Cash” and “Cash Invested” which are counted by this measure.

AVG_CASH_PERCENT_BUD = IF(SELECTEDVALUE(AVG_CASH_ACT[CATEGORY]) = "% of Cash Invested", FORMAT([AVG_CASH_BUD], "0%;(0%);-"),[AVG_CASH_BUD])
 
AVG_CASH_BUD =
VAR __BUD = CALCULATE(SUM(AVG_CASH_ACT[AMOUNT]),
                    AVG_CASH_ACT[SCENARIO] = "Budget")
VAR __BUD_YTD = TOTALYTD(CALCULATE(SUM(AVG_CASH_ACT[AMOUNT]),
                    AVG_CASH_ACT[SCENARIO] = "Budget"),'Calendar'[Date])
VAR __MONTH = SELECTEDVALUE('Calendar'[MonthNo])
RETURN
IF(MAX('AVG_CASH_ACT'[CATEGORY]) in {"Net Interest (Cumulative)", "Interest on debt","Interest on deposits"}, __BUD,__BUD_YTD/__MONTH)
 
 
 

As you can see, it should come out 73%. How to do this?