Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi!
I am having trouble writing a DAX formula for a calculated column. In summary, my organization recieves a ton of orders everyday from different customers. It is possible that an order can be "open" for a few days before stock is confirmed and the order is shipped. Sometimes an order is dropped in the system which could happen for a variety of reasons. I am trying to track these orders that are dropped. Currently, I have a formula that works and uses the TODAY() function. I would like to use a new formula that eliminates the use of TODAY() so I can track historicals and weekly averages. An example of what I am looking for is below.
| DATE | ORDER ID | LOST ORDER CHECK |
| 1/1 | 123 | 0 |
| 1/1 | 456 | 1 |
| 1/1 | 789 | 0 |
| 1/2 | 123 | 0 |
| 1/2 | 789 | 0 |
I would like a 1 registered next to order 456 since it does not appear on 1/2, but appeared on 1/1. I would appreciate any help! Unfortunately, I cannot share any data as it is highly confidential. And again, I would like to eliminate my use of the TODAY() function, thanks in advance!
Solved! Go to Solution.
You may probably try:
LOST ORDER =
VAR __OrderID = [ORDER ID]
VAR __Date = [DATE]
VAR __Table = FILTER('Table',[DATE] = __Date + 1.)
RETURN
SWITCH(TRUE(),
__Date = TODAY(),0,
__OrderID IN SELECTCOLUMNS(__Table,"OrderID",[ORDER ID]),0,
1
)
Well, perhaps something like this:
LOST ORDER =
VAR __OrderID = [ORDER ID]
VAR __Date = [DATE]
VAR __Table = FILTER('Table',[DATE] = __Date + 1.)
RETURN
IF(__OrderID IN SELECTCOLUMNS(__Table,"OrderID",[ORDER ID]),0,1)
Seems as if this is working! Thank you very much!!! One more thing - it registers a 1 for all of today's order since there is no entries for tomorrow. Is it possible to manipulate this formula to exclude 1's from today's date? Thank you!!
You may probably try:
LOST ORDER =
VAR __OrderID = [ORDER ID]
VAR __Date = [DATE]
VAR __Table = FILTER('Table',[DATE] = __Date + 1.)
RETURN
SWITCH(TRUE(),
__Date = TODAY(),0,
__OrderID IN SELECTCOLUMNS(__Table,"OrderID",[ORDER ID]),0,
1
)
This is a huge help ... thank you very much!!! One last request if you have the time - can we exclude the last day of each month in the calculation? Orders every month get piled up until a new month where everything resets. So right now it is showing that I lose all of my orders at the beginning of each beginning of month / rest. Thank you again!!
Let's see...
LOST ORDER =
VAR __OrderID = [ORDER ID]
VAR __Date = [DATE]
VAR __Table = FILTER('Table',[DATE] = __Date + 1.)
RETURN
SWITCH(TRUE(),
__Date = TODAY(),0,
__Date = EOMONTH(__Date,0),0,
__OrderID IN SELECTCOLUMNS(__Table,"OrderID",[ORDER ID]),0,
1
)
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 39 | |
| 37 | |
| 33 | |
| 32 | |
| 29 |
| User | Count |
|---|---|
| 132 | |
| 88 | |
| 82 | |
| 68 | |
| 64 |