Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply

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

I have given below dataset

ashishoza12345_2-1635981484080.png

 

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.

 

ashishoza12345_3-1635981535435.png

 

Please help.
Thanks in Advance!

 

 

 

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
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.

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

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.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

Ashish_Mathur
Super User
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
https://www.linkedin.com/in/excelenthusiasts/
jdbuchanan71
Super User
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.

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors