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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Oana
Frequent Visitor

Conditional Column

Hello PowerBI power users: 

 

I hope you can help me find a solution to this problem: I am trying to add a conditional column that will find out an Invoice Due Date if the values in two other columns meet these two criteria: the Vendor Invoice Number is the identical, and the Trans Code is "P". 

The same Vendor Invoice Number can have several rows in the table, and whenever the Trans Code column contains a P there will be an Invoice Due Date, and it will be the same, but when the Trans Code will be a "T" or an "F" that Invoice Due Date column will be blank. I need that column to contain the same date, as an invoice will always have the same Invoice Due Date. 

I dont' want to use Group By in Power Query, because the table has so many more columns, I need the date to be added to where it is missing. I hope someone has done this before and knows a solution, thank you!

 

Vendor NumberVendor Invoice NumberInvoice DateLine NumberTrans CodeInvoice AmountInvoice Due DateDays Past Due

2472410659709711/19/20216P$1.0012/24/202114
2472410659709711/19/20210F$2.00  
2567410661419011/30/20211P$3.001/4/20223
2567410661419011/30/20210F$4.00  
12345410661419111/30/20211P$5.001/4/20223
12345410661419111/30/20210F$5.00  
68945410665083012/20/20211P$5.001/24/2022-17
68945410665083012/20/20212P$10.001/24/2022-17
68945410665083012/20/20216P$5.001/24/2022-17
68945410665083012/20/20214P$5.001/24/2022-17
68945410665083012/20/20210T$5.00  

 

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Oana ,

 

Taking into account that you want all the same value in the column have you tried sorting the table by Vendor, Vendor invoice number and then by Due Date after that on the due date just do a fill down?

 

All the blanks will get replaced by the value that is above and all is solved.

 

Be aware I'm assuming that you have at least one due date filled in your invoices so all of them have the P and not only the T or F.

 

If that does not happen you need to make a group by and then reference back within the query code.

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

Hi @Oana,

I think the 'fill down' feature in query edit should help with your requirement, you can use them to fill the records which blank with the previous row value.

How to Fill Down Blank or Null Cells in Power Query - Excel Campus
BTW, I also think you need to use the 'group by' function at first and nested the 'fill down' function to prevent the fill function work on the wrong row groups.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
MFelix
Super User
Super User

Hi @Oana ,

 

Taking into account that you want all the same value in the column have you tried sorting the table by Vendor, Vendor invoice number and then by Due Date after that on the due date just do a fill down?

 

All the blanks will get replaced by the value that is above and all is solved.

 

Be aware I'm assuming that you have at least one due date filled in your invoices so all of them have the P and not only the T or F.

 

If that does not happen you need to make a group by and then reference back within the query code.

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.