Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi there,
Lets say I have these values:
Money | State |
500 | CA |
200 | FL |
100 | CO |
250 | AL |
200 | NY |
I want to combine the values of 'CA', 'FL' and 'CO'. So that will be 500+200+100 = 800. I want to give this a new column name, for example 'best-states'. A measure needs to be able to do this for me, but I don't know how. The other values of the states needs to stay the same.
Thanks!
Solved! Go to Solution.
Hi,
You can create new column:
Group State = SWITCH('Table'[State],
"CA", "best-state",
"FL", "best-state",
"CO", "best-state",
'Table'[State])
And use it to create table or visuals:
_______________
If I helped, please accept the solution and give kudos! 😀
@Anonymous
Better create a new column
New column =
Switch(True(),
[State] in {"CA","FL",,"CO"},"best-states",
//Other connditions
"Oher states"
}
Hi,
You can create new column:
Group State = SWITCH('Table'[State],
"CA", "best-state",
"FL", "best-state",
"CO", "best-state",
'Table'[State])
And use it to create table or visuals:
_______________
If I helped, please accept the solution and give kudos! 😀
If I try this my other states are gone, only those 3 are there
Edit: my Power BI wasn't showing it well, it works !
Hi @Anonymous
how do you define values of 'CA', 'FL' and 'CO'? If it always will be a constant try a measure
Measure =
IF(SELECTEDVALUE(Table[State]) IN {"CA", "FL", "CO"},
CALCULATE(SUM(Table[Money]), Table[State] IN {"CA", "FL", "CO"}),
SELECTEDVALUE(Table[Money])
)
@az38 Yes they are constant. This seems helpful, but I have more states that I want to combine and give a new name. How can I do that? And where in your measure is the new column name?
Thanks!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |