IF Function needs a calculation


#1

Hello DNA Community,

I have in theory a simple question, but in practice its looks harder to achieve, and this blocked me many times when trying to get coniditions inside my formulas.

What I have is a column with 0 & 1 depending on a specific Intern criteria. I need to retrieve an amount from column X if its 0 and an amount from colunm Y if its 1. It is simple in Excel IF(CellA1=1 ; True ; False) but in power bi its seems more difficult to create this row by row verification context. (the column only contains 0 or 1 nothing els)

See attach the data I m working with.

Any Ideas


#2

This is where iterating functions really are the key.

All of this logic can and should be completed in a measure.

For example

SUMX( tablename,
IF( ColumnName = 1, ColumnName, BLANK() )

You could also use FILTER is a similar way with CALCULATE.

These should be very easy to complete with either of these methods.

See here for more information on iterating functions