Forum Discussion
Anonymous
4 years agoNot applicable
New column
Hi, I have a table with different measures and columns, including columns account number, account group, and a measure called Totalsum. I want to add a column called Income with the following 4-row ...
Anonymous
4 years agoNot applicable
Hi Greg_Deckler
What I want to add are rows with the logic mentioned above.
I used the following expression to create the column Income with the rows names Group1, Group2, and Group3, but I don't know how to get the row name All costs( it's the sum of the other three rows)
Income=
var g1 = account no=3 var g2 = account no= 2 || account no= 3 || account no = 5 && account group <> 20 var g3= account group = 20 return SWITCH(TRUE(),g1,"Group1",g2,"Group2",g3,"Group3")
So How can I add the row name All costs in the above expression?
Greg_Deckler
4 years agoCommunity Champion
Anonymous Use a disconnected table with your group names including the All costs group. Then you can create a measure like this:
Measure =
VAR __Group = MAX('DisconnectedTable'[Column])
RETURN
SWITCH(__Group),
"Group1", CALCULATE('Table'[Income]),'Table'[AccountNo] = 3,
...
)