Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
I have this table:
I want to compare the Invoice Date Column vs the Change Date Time Column and then return the Last Daily Change for the Change Date Time that has the closest before value.
In this example below:
Invoice Date: 1/15/2021
Closest before Change Date and Time: 6/14/19 15:17
Last Daily Change: .4495
I would like to create this as a DAX measure and insert the Last Daily Change Value into an existing visual on my dashboard that is showing Invoice#, Invoice date and some other sales information.
INVOICE | INVOICE DATE | Part # | LINE | FIELD_NAME | BEFORE | AFTER | DATE_CHG | Last Daily Change | Changed Date Time |
22555 | 1/15/21 | 100-1 | 100 | Rate | 0.415 | 2/8/19 | 0.415 | 2/8/19 11:09 | |
22555 | 1/15/21 | 100-1 | 100 | Rate | 0.415 | 0.49 | 2/13/19 | 0.49 | 2/13/19 6:27 |
22555 | 1/15/21 | 100-1 | 100 | Rate | 0.49 | 0.5195 | 2/27/19 | 0.5195 | 2/27/19 12:19 |
22555 | 1/15/21 | 100-1 | 100 | Rate | 0.5195 | 0.4495 | 6/14/19 | 0.4495 | 6/14/19 15:17 |
22555 | 1/15/21 | 100-1 | 100 | Rate | 0.4495 | 0.91 | 5/17/21 | 0.91 | 5/17/21 10:48 |
22555 | 1/15/21 | 100-1 | 100 | Rate | 0.91 | 1.12 | 9/22/21 | 1.12 | 9/22/21 16:30 |
22555 | 1/15/21 | 100-1 | 100 | Rate | 1.12 | 0.4495 | 12/3/21 | 1.12 | 12/3/21 7:28 |
22555 | 1/15/21 | 100-1 | 100 | Rate | 0.4495 | 1.12 | 12/3/21 | 1.12 | 12/3/21 7:30 |
22555 | 1/15/21 | 100-1 | 100 | Rate | 1.12 | 0.4495 | 12/10/21 | 1.12 | 12/10/21 6:53 |
22555 | 1/15/21 | 100-1 | 100 | Rate | 0.4495 | 0.91 | 12/10/21 | 1.12 | 12/10/21 7:10 |
22555 | 1/15/21 | 100-1 | 100 | Rate | 0.91 | 1.12 | 12/10/21 | 1.12 | 12/10/21 7:12 |
22555 | 1/15/21 | 100-1 | 100 | Rate | 1.12 | 0.91 | 12/10/21 | 1.12 | 12/10/21 7:18 |
22555 | 1/15/21 | 100-1 | 100 | Rate | 0.91 | 1.12 | 12/10/21 | 1.12 | 12/10/21 7:19 |
22555 | 1/15/21 | 100-1 | 100 | Rate | 1.12 | 0.4395 | 1/26/22 | 1.12 | 1/26/22 16:09 |
22555 | 1/15/21 | 100-1 | 100 | Rate | 0.4395 | 0.8455 | 1/26/22 | 1.12 | 1/26/22 16:42 |
22555 | 1/15/21 | 100-1 | 100 | Rate | 0.8455 | 0.91 | 1/26/22 | 1.12 | 1/26/22 16:43 |
22555 | 1/15/21 | 100-1 | 100 | Rate | 0.91 | 0.965 | 1/26/22 | 1.12 | 1/26/22 16:44 |
22555 | 1/15/21 | 100-1 | 100 | Rate | 0.965 | 1.02 | 1/26/22 | 1.12 | 1/26/22 16:45 |
22555 | 1/15/21 | 100-1 | 100 | Rate | 1.02 | 1.12 | 1/26/22 | 1.12 | 1/26/22 16:46 |
Solved! Go to Solution.
Hi @Swilson2112 ,
You may try this Measure.
Last Daily Change Value =
VAR max_date =
MAXX (
FILTER ( 'Table', 'Table'[INVOICE DATE] > 'Table'[Changed Date Time] ),
'Table'[Changed Date Time]
)
RETURN
CALCULATE (
MAX ( 'Table'[Last Daily Change] ),
FILTER ( 'Table', 'Table'[Changed Date Time] = max_date ),
VALUES ( 'Table'[INVOICE] )
)
Then, the result will look like this.
Also, attached the pbix file as reference.
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!
Best Regards,
Community Support Team _ Caiyun
Hi @Swilson2112 ,
You may try this Measure.
Last Daily Change Value =
VAR max_date =
MAXX (
FILTER ( 'Table', 'Table'[INVOICE DATE] > 'Table'[Changed Date Time] ),
'Table'[Changed Date Time]
)
RETURN
CALCULATE (
MAX ( 'Table'[Last Daily Change] ),
FILTER ( 'Table', 'Table'[Changed Date Time] = max_date ),
VALUES ( 'Table'[INVOICE] )
)
Then, the result will look like this.
Also, attached the pbix file as reference.
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!
Best Regards,
Community Support Team _ Caiyun
User | Count |
---|---|
12 | |
12 | |
8 | |
8 | |
6 |
User | Count |
---|---|
27 | |
19 | |
14 | |
11 | |
7 |