March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hey guys,
So I am trying to show if an invoice is complete or pending for all lines it exists if it is either.
This is based off 2 columns. Invoice number and reporting date.
Above is an example of a single invoice that is still appearing on the report. I want to have a column that for all lines reads ‘pending’ if the max report date of an invoice # is equal to the most recent report date. If it is less than the most recent report date, I want it to read "complete" for all lines.
I have a few custom Columns I have been playing with:
Current Date = MAX('Complete & Pending'[Reporting Date ])
Complete Pending = IF('Complete & Pending'[Reporting Date ].[Date] < 'Complete & Pending'[Current Date], "Complete", "Pending")
For instance,
Since the max [Reporting Date] and the [Current Date] match for this invoice, I want the 4th column to read ‘pending’ for all the lines. Any ideas?
Thanks
Solved! Go to Solution.
@Anonymous
Try following
Complete Pending = IF ( CALCULATE ( MAX ( 'Complete & Pending'[Reporting Date ] ), ALLEXCEPT ( 'Complete & Pending', 'Complete & Pending'[Invoice Num] ) ) < 'Complete & Pending'[Current Date], "Complete", "Pending" )
@Zubair_MuhammadThanks for your help!. However, when I used your formula, it changed 100% of my invoices to pending. In the image below, i've added a second invoice, this one is "complete" as current date > report date for it. The top invoice lines should read "complete" and the bottom "pending".
Does this view help? I've added your formula below for continuity. Thank you!
Zubair Test = IF( CALCULATE(MAX('Complete & Pending'[Reporting Date ].[Date]),ALLEXCEPT('Complete & Pending','Complete & Pending'[Invoice Num]))<'Complete & Pending'[Currrent Date], "Complete", "Pending")
@Anonymous
Just remove the .[Date] from your formula.
In my formula i just used (MAX('Complete & Pending'[Reporting Date ])
Zubair Test = IF( CALCULATE(MAX('Complete & Pending'[Reporting Date ].[Date]),ALLEXCEPT('Complete & Pending','Complete & Pending'[Invoice Num]))<'Complete & Pending'[Currrent Date], "Complete", "Pending")
Thanks! That worked. Can you explain why that date syntax messed up the formula? When I added that column it auto-populated with that info because it's a date heirarchy.
@Anonymous
Power BI automatically creates one date table for each date column in the model. When you use .[Date] you refer to that table rather than the original one.
Here is a relevant article
https://www.sqlbi.com/articles/automatic-time-intelligence-in-power-bi/
@Anonymouswith the salt!
In this instance I was having difficulty getting what I wanted in PQ so I started down the DAX route. So no valid reason besides my knowledge of the program. I'm still quite new to PBi (obviously)
So then. Given the PQ Below, which is the source for the columns above. How can I get what I am looking for based on the information I provided above?
Thanks!!
Hey @Anonymous,
I'm sorry, hopefully I'm missing something. But your file does not solve my problem. You do some cool transformations in it, and I will keep it for reference. But lets try again.
It might help if I give as much context as I can. This is based on a report for invoices that have problems with them. I receive this report weekly. When a given invoice stops showing up on the invoice, it means it is closed, or completed. I am tasked with creating a dashboard that shows which invoices are open, and how long they have been open. Once they’re closed, I need to be able to count how many weeks it took for the problematic invoice to be closed.
Inv# Report Date Max Report Date Column I want
1 | 7/29/2019 | 9/2/2019 | Pending |
1 | 8/5/2019 | 9/2/2019 | Pending |
1 | 8/12/2019 | 9/2/2019 | Pending |
1 | 8/26/2019 | 9/2/2019 | Pending |
1 | 9/2/2019 | 9/2/2019 | Pending |
2 | 7/29/2019 | 9/2/2019 | Complete |
2 | 8/5/2019 | 9/2/2019 | Complete |
2 | 8/12/2019 | 9/2/2019 | Complete |
3 | 7/29/2019 | 9/2/2019 | Complete |
3 | 8/5/2019 | 9/2/2019 | Complete |
3 | 8/12/2019 | 9/2/2019 | Complete |
3 | 8/26/2019 | 9/2/2019 | Complete |
4 | 7/29/2019 | 9/2/2019 | Complete |
5 | 8/5/2019 | 9/2/2019 | Complete |
5 | 8/12/2019 | 9/2/2019 | Complete |
6 | 8/26/2019 | 9/2/2019 | Pending |
6 | 9/2/2019 | 9/2/2019 | Pending |
7 | 9/2/2019 | 9/2/2019 | Pending |
8 | 9/2/2019 | 9/2/2019 | Pending |
I’ve made a small sample dataset for you. The goal is, using Columns A, B, C, create a Power Query that returns me the values in column D.
Given the context of the project, if you believe this approach is not the solution, please help explain how I should be solving this logic.
Thanks again for your help,
-DK
P.S. is there a better way for me to attach a table to a response?
@Anonymous I have the DAX version of the solution working. However, I would /love/ to see your clean M solution
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
21 | |
18 | |
17 | |
7 | |
5 |
User | Count |
---|---|
32 | |
27 | |
19 | |
13 | |
12 |