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
Anonymous
Not applicable

Add Columns If they exist

Hi,

1. This is some dummy data I created in excel but my query returns something similar to this kind of scenario 

MysticAj_0-1619040286517.png

2. Transform Data > Select Fruit Column > Pivot Column > Values Column (Quantity) > Aggregate Function (Sum).It creates something like this below

MysticAj_1-1619040670505.png

3. Now I need to create another column that adds all the quantities related to melons category. For ex sometimes the query may return only Watermelon and Muskmelon and sometimes maybe just Honeydew melon and sometimes maybe Honeydew and Muskmelon. How to create total column by checking if a column exists and then add? However I know for sure the query returns only four fruits related to melons (i.e they are hardcoded)

 

 

 

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

Your first table was in the best structure.  Why have you pivoted the data in the Query Editor?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Checking to see if what I am trying to achieve here is clear or not. I can reframe the requirement if it is not clear.

Hi,

I do not know how to solve this question in your revised structure.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi,

 

My end user requires it that way. 

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