cancel
Showing results for
Did you mean:
Frequent Visitor

## create a new calculated column if values are found in a column then calculate from other column

I have given below dataset

I would like to create a new calculated table using the above given table where we can categorise the city gender and an age group for summing up the "Numbers" Column.

1 ACCEPTED SOLUTION
Super User

Add a new calcualted column like this.

``````Age Group =
SWITCH (
TRUE (),
Table[Age] < 12, "0-11",
Table[Age] < 16, "12-15",
Table[Age] < 25, "16-24",
Table[Age] < 31, "25-30",
Table[Age] < 36, "31-35",
Table[Age] < 41, "36-40",
"40+"
)``````

You would just need to adjust the ranges to match what you want to show in your report.

3 REPLIES 3
Community Support

Hi @ashishoza12345,

Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or accept the helpful suggestions to help others who faced similar requirements.

If these also don't help, please share more detailed information to help us clarify your scenario to test.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Super User

Hi,

After creating the calculated column as suggested by @jdbuchanan71, create a matrix visual and drag City/Gender to the row labels and Age Group to the column labels.  Write this measure

Total = sum(Data[Numbers])

Hope this helps.

Regards,
Ashish Mathur
http://www.ashishmathur.com
Super User

Add a new calcualted column like this.

``````Age Group =
SWITCH (
TRUE (),
Table[Age] < 12, "0-11",
Table[Age] < 16, "12-15",
Table[Age] < 25, "16-24",
Table[Age] < 31, "25-30",
Table[Age] < 36, "31-35",
Table[Age] < 41, "36-40",
"40+"
)``````

You would just need to adjust the ranges to match what you want to show in your report.

Announcements

#### Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

#### Charticulator Design Challenge

Put your data visualization and design skills to the test! This exciting challenge is happening now through May 31st!

#### What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

#### Check it out!

Mark your calendars and join us on Thursday, May 26 at 11a PDT for a great session with Ted Pattison!

Top Solution Authors
Top Kudoed Authors