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
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.
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

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.

Top Solution Authors