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

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.

Reply
iceteapilot
Helper I
Helper I

Add additional column in Query Editor

Hi,

 

I have data set for UAE automobile vehicle sales for 10 year period. So there are basically two types of vehicles in the data set: Mainstream and Premium. Within mainstream say there are 12 segments and within premium 6 segments. Each of the premium segments has a segment name with the word Untitled.png

 

premium attached to it unlike the mainstream segment. Example: B Premium Car, C Premium Car, etc.

How do i add an additional column with these details against each of the cars?

There are 5530 rows in the data set, maybe 4000+ for mainstream and balance for premium cars.

 

Attaching a screenshot..thanks in advance for feedback.  

 

1 ACCEPTED SOLUTION

Hi @iceteapilot ,

 

Try to create a conditional column(Add Column -> Conditional column) in "Edit Queries";

a1.PNG

a2.PNG

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
Greg_Deckler
Super User
Super User

Difficult to say, I don't understand the logic of what data you want to add. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Logic is i want to add a column based on the segment name.

Wherever the segment name contains the word 'premium', the new column should have 'Premium Segment' in it.

Where there is no premium mentioned, 'mainstream segment' needs to be inserted in the new column..

 

 

Hi @iceteapilot ,

 

Try to create a conditional column(Add Column -> Conditional column) in "Edit Queries";

a1.PNG

a2.PNG

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

HI @iceteapilot ,

 

You can create a calculated column using DAX expression as follows:

 

Segment Category = IF(CONTAINSSTRING(Table1[Segment name], "premium") = TRUE(), "Premium Segment", "Mainstream Segment")

 

Replace "Table1" with your table-name and "Segment name" with your segment name column in the above DAX.

 

If this helps and resolves the issue, appreciate a Kudos and mark it as a Solution! 🙂

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Pragati11
Super User
Super User

Hi @iceteapilot ,

 

You can create a custome column in Query Editor using "Add Column" or you can even create a new calculated column using DAX expression.

 

In your screenshot below I see 5 columns. How do you check SEGMENT column for Mainstream or Premium? Like what all segements come under Premium and whatt segments come under mainstream?

If you can tell me the logic, I can try writing a DAX for you.

 

If this helps and resolves the issue, appreciate a Kudos and mark it as a Solution! 🙂

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Thanks for the response.

 

All the premium segments contain the word premium..pls check the attached screenshot.

 

AshishUntitled.png

 

HI @iceteapilot ,

 

If you have already got a column containing those values - A Premium car, etc.; what you want to be added in new column?

Please explain your requirement properly, it is not clear.

 

If this helps and resolves the issue, appreciate a Kudos and mark it as a Solution! 🙂

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.