Forum Discussion

AliceW's avatar
AliceW
Icon for Power Participant rankPower Participant
6 years ago

Convert a multiple IF formula from DAX to M

Hi folks,

I am terrible at M and I really need this formula in the Power Query so that I can then unpivot the table. Could anybody help me, please?

 

2019-01 =
SWITCH('Business'[Line],
"Lyme",
if(AND(related(Business[Close Date])<=date(2019,01,31),related(Business[Close Date])>=date(2019,01,01)),
[Amount]),
"Mountain",
if(and(related(Business[Start Date])<=date(2019,01,31),related(Business[End Date])>=date(2019,01,01)),
divide('Row'[Amount],'Row'[Term]))
"Earth",
if(and(related(Business[Start Date])<=date(2019,01,31),related(Business[Start Date])>=date(2019,01,01)),
('Row'[Amount]*0.6),
if(and(related(Opp[Start Date])<=date(2019,01,31),related(Opp[End Date])>=date(2019,01,01)),
divide('Row'[Amount]*0.4,'Row'[Term])))
)

 

If 'related' doesn't work, I can easily calculate these columns in the 'Row' table.

A big thank you.

Alice

3 Replies