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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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

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

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

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

Brookied
Helper I
Helper I

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

amitchandak
Super User
Super User

@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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors