cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Brookied
Helper I
Helper I

introducing data via calculated column

I have a data set that includes the folloiwng information, 

 

Income Date, Amount, Source Code, Payment menthod. 

Brookied_0-1610639781788.png

 

What i am looking for is a way to add some caluclated data based on the Source Code and Payment Method.  This would normally be done via an sql statment in the Legacy CRM but we are migrating into CRM365 and as such cannot be added as a calculated field (so i am told).  Is it possible to add via PowerBI once i refresh the income data 

 

The Script in a simpliefed version is below but where we have "Sourcecode like 'ADSO%"  i think this should be 'Source Code begins with ADSO' in PowerBi 

 

If the below is true the add REG into the line 

((Payment Method = 'Standing Order' or Payment Method = 'Direct Debit' or Payment Method = 'Standing Order' or Payment Method = 'Give As You Earn' or Payment Method = 'Paperless Direct Debit')

or

((Payment Method = 'CAF Voucher' or Payment Method = 'Credit Card')

and

(Sourcecode like 'ARS%' or .Sourcecode like 'ADSO%' or .Sourcecode like 'ARC%'))

or

((PaymentType = 'Bank Credit Transfer')

and

(.Sourcecode like 'ARS%' or Sourcecode like 'ARD%' or Sourcecode like 'ARC%'

or Sourcecode like 'ARP%' or Sourcecode like 'CV%' or Sourcecode like 'SO%' or Sourcecode = 'GO')))

 

IF below then use Adhoc

and not

((PaymentType = 'Standing Order' or PaymentType = 'Direct Debit' or PaymentType = 'Standing Order' or PaymentType = 'Give As You Earn' or PaymentType = 'Paperless Direct Debit')

or ((PaymentType = 'CAF Voucher' or PaymentType = 'Credit Card') and (batchdetail.Sourcecode like 'ARS%' or batchdetail.Sourcecode like 'ADSO%' or batchdetail.Sourcecode like 'ARC%'))

or ((PaymentType = 'Bank Credit Transfer') and (batchdetail.Sourcecode like 'ARS%' or batchdetail.Sourcecode like 'ARD%' or batchdetail.Sourcecode like 'ARC%'

or batchdetail.Sourcecode like 'ARP%' or batchdetail.Sourcecode like 'CV%' or batchdetail.Sourcecode like 'SO%' or batchdetail.Sourcecode = 'GO')))

 

 
Income DateAmountSource CodePayment MethodIncome Frequency
26/11/202010.00ARSO20-01Credit CardREG
26/11/202025.00ADDI20-09CashAdhoc

 

This would be applied to 45k lines of income monthly when imported into PowerBI

 

Is this even possible?

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @Brookied ,

 

You could add a conditional column in Query Editor.

Check the docement for more details.

https://docs.microsoft.com/en-us/power-query/add-conditional-column 

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

3 REPLIES 3
v-jayw-msft
Community Support
Community Support

Hi @Brookied ,

 

You could add a conditional column in Query Editor.

Check the docement for more details.

https://docs.microsoft.com/en-us/power-query/add-conditional-column 

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

Brookied
Helper I
Helper I

Morning, thanks for the feedback and link to video,  Will give it a try now. 

amitchandak
Super User IV
Super User IV

@Brookied , In power bi for text you have use double quotes

In power query if then else (and or ) Text.Contains and Text.Start to check starting 4 character

https://docs.microsoft.com/en-us/powerquery-m/text-contains

 

in DAX

if(<Logic>, <then>, <else>)  Search , find. && (and) || (or) Left for first few character

Search , find - https://www.youtube.com/watch?v=mZt0HJw4gjQ



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!

Helpful resources

Announcements
User Groups Public Preview

Join us for our User Group Public Preview!

Power BI User Groups are coming! Make sure you’re among the first to know when user groups go live for public preview.

March Update

Check it Out!

Click here to read more about the March 2021 Updates!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.