Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi All,
Novice in power query,hope i can get some advise.
I need to calculate pass/fail for different document types based off different date fields.
if doc type equals invoice and invoice date is less than creation date, Fail [Obviously the pass result side of that]
If doc type equals PL and departure date is less than creation date, Fail [Again the pass result of that ]
Not sure how to approach this, hope i am clear in the ask
Many thanks
Solved! Go to Solution.
Hi @DairyG1
Can you provide some sample data and expected result? If you have columns similar to below, you can add a custom column with code similar to below:
if [Doc Type] = "Invoice" and [Invoice Date] < [Creation Date] then "Fail" else if [Doc Type] = "PL" and [Departure Date] < [Creation Date] then "Fail" else "Pass"
Reference: Power Query If statement: nested ifs & multiple conditions (exceloffthegrid.com)
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Hi @DairyG1
Can you provide some sample data and expected result? If you have columns similar to below, you can add a custom column with code similar to below:
if [Doc Type] = "Invoice" and [Invoice Date] < [Creation Date] then "Fail" else if [Doc Type] = "PL" and [Departure Date] < [Creation Date] then "Fail" else "Pass"
Reference: Power Query If statement: nested ifs & multiple conditions (exceloffthegrid.com)
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
For an easy way to do it, you can break your code up into smaller portions using the conditional column option when you go to Add Column in the PQ menu and then based on the results of the columns created combine the logic or write an if statement in PQ using Custom Column option
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.