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,
According to your description, I can roughly understand your requirement, but based on the needs you said that you want to get the Last Daily Change for the Change Date Time that has the closest before value, I think the Changed date time should be 5/17/21 10:48 instead of the 6/14/19 15:17, right?
If you don’t have a problem, you can try this method to get the expected result:
You can create a calculated column like this:
Date diff =
abs(DATEDIFF('Table'[Changed Date Time],'Table'[INVOICE DATE],SECOND))
Then create a measure like this:
Flag =
var _mindiff=MINX(ALL('Table'),'Table'[Date diff])
return
IF(MAX('Table'[Date diff])=_mindiff,1,0)
And you can create a table chart to place the measure as the visual filter to get what you want, like this:
You can download my test pbix file below
If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.
How to Get Your Question Answered Quickly
Thank you very much!
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
According to your description, I can roughly understand your requirement, but based on the needs you said that you want to get the Last Daily Change for the Change Date Time that has the closest before value, I think the Changed date time should be 5/17/21 10:48 instead of the 6/14/19 15:17, right?
If you don’t have a problem, you can try this method to get the expected result:
You can create a calculated column like this:
Date diff =
abs(DATEDIFF('Table'[Changed Date Time],'Table'[INVOICE DATE],SECOND))
Then create a measure like this:
Flag =
var _mindiff=MINX(ALL('Table'),'Table'[Date diff])
return
IF(MAX('Table'[Date diff])=_mindiff,1,0)
And you can create a table chart to place the measure as the visual filter to get what you want, like this:
You can download my test pbix file below
If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.
How to Get Your Question Answered Quickly
Thank you very much!
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
User | Count |
---|---|
13 | |
12 | |
8 | |
8 | |
6 |
User | Count |
---|---|
28 | |
19 | |
13 | |
11 | |
7 |