the_new_guy
the_new_guy

Reputation: 197

How to convert the following tableau calculation into DAX powerbi?

I have a tableau measure which goes like this:

ColumnA= IF [Rating Projection Year 1] = 2021
THEN SUM([Weights Ly]*[Next year rating predicted (1)]*[Inclusion Flag Ly])/SUM([Weights Ly]*[Inclusion Flag Ly])
ELSEIF  [Rating Projection Year 1] = 2022
THEN SUM([Weights Cy]*[Next year rating predicted (1)]*[Inclusion Flag Cy])/SUM([Weights Cy]*[Inclusion Flag Cy])
ELSE 0
END

How can I convert the same in DAX powerbi? Thanks

Upvotes: 0

Views: 67

Answers (1)

ttruhcheva
ttruhcheva

Reputation: 424

Try this(Switch Case):

ColumnA = SWITCH(TRUE(), 
[Rating Projection Year 1] = 2021, SUM([Weights Ly] * [Next year rating predicted (1)]*[Inclusion Flag Ly])/SUM([Weights Ly] * [Inclusion Flag Ly]),
[Rating Projection Year 1] = 2022, SUM([Weights Cy] * [Next year rating predicted (1)]*[Inclusion Flag Cy])/SUM([Weights Cy] * [Inclusion Flag Cy]),
0)

Upvotes: 0

Related Questions