cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kev_bro
Frequent Visitor

Insert Column with text based on another column

Hi all , 

New to the Community and also using Power BI , so apologies if the below done not seem clear 

 

I am trying to group clientswhich  have mutiple products , so I first want to know which clients have a "SIPP" Product and if they have any of the other products and what the total value is ( clear in the output I would expect to see) 

 

Account NumberClient Id Product Type Amount
A00001CLID1SIPP£25.00
A00001CLID1SIPP£25.00
A00002CLID1GIA£200.00
A00003CLID2GIA£500.00
A00004CLID3SIPP£100.00

 

I have assumed I am likely going to need to add another column when trabsforming and use the switch function top to add a yes value if the client has  "SIPP" text under  Product Type . Then then some further filtering or meassure to then look up at client level those that have a SIPP product and potential flag another field with Yes across each row so that when you get into reporting you can identiy a count of the client holding "SIPP" Product Type only vs those that Are holding "SIPP" and "GIA " vs those that are not hold "SIPP)

 

Thus in the above example once in the report I would expect to see CLID1 has a SIPP and Other product with value of £450 and CLID2 does not hold a SIPP and their value is £500

ClLI3 Holds only a SIPP with a value of £100

 

If anyone able to point me in the direction of what I need to do eitheir through transforming my data set or using measures would be most appreciative 

Thanks 

1 ACCEPTED SOLUTION
amitchandak
Super User IV
Super User IV

@kev_bro , the expected output is not clear.

A new column like this can help?

 

New column =
var _SIPP = countx(filter(Table,[Client Id] =earlier([Client Id]) && [Product Type] = "SIPP"),[Account Number])
var _Not = countx(filter(Table,[Client Id] =earlier([Client Id]) && [Product Type] <> "SIPP"),[Account Number])
return
switch(true(),
not(isblank(_SIPP)) && not(isblank(_not)), "SIPP and Others",
not(isblank(_SIPP)) && (isblank(_not)) ,"Only SIPP",
(isblank(_SIPP)) && not(isblank(_not)) ,"No SIPP",
"Others"
)



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

2 REPLIES 2
kev_bro
Frequent Visitor

@amitchandak thanks for the super fast response and the help 

amitchandak
Super User IV
Super User IV

@kev_bro , the expected output is not clear.

A new column like this can help?

 

New column =
var _SIPP = countx(filter(Table,[Client Id] =earlier([Client Id]) && [Product Type] = "SIPP"),[Account Number])
var _Not = countx(filter(Table,[Client Id] =earlier([Client Id]) && [Product Type] <> "SIPP"),[Account Number])
return
switch(true(),
not(isblank(_SIPP)) && not(isblank(_not)), "SIPP and Others",
not(isblank(_SIPP)) && (isblank(_not)) ,"Only SIPP",
(isblank(_SIPP)) && not(isblank(_not)) ,"No SIPP",
"Others"
)



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

Helpful resources

Announcements
MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Urdu Hindi D365 Bootcamp 768x460.png

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors