Forum Discussion
FIRSTDATE and LASTDATE functions broken?
- Anonymous8 years ago
HI sanimesa,
I'm not so sure why firstdate and lastdate function not works on your side. (I test with last version without any issue)
Can you please share pbix file to test?
In addition, you can also try to use below formula to instead:Invoice Date Selected = "Reporting Period: " & FORMAT ( MINX ( ALLSELECTED ( InvoiceTable[InvoiceDate] ), [InvoiceDate] ), "MMMM DD, YYYY" ) & " - " & FORMAT ( MAXX ( ALLSELECTED ( Reporting_JSG_ConsolidatedOrders[InvoiceDate] ), [InvoiceDate] ), "MMMM DD, YYYY" )Regards,
Xiaoxin Sheng
- Anonymous8 years ago
HI sanimesa,
After checking your pbix file, I found it similar as @KHorseman said, 'firstdate' and 'lastdate' function not works if your date table contains duplicate records.
I modify my formula and current it can works on your scenario, please take a look at below formula:Invoice Date Selected = "Reporting Period: " & FORMAT ( MINX ( VALUES ( Sheet2[InvoiceDate] ), [InvoiceDate] ), "MMMM DD, YYYY" ) & " - " & FORMAT ( MAXX ( VALUES ( Sheet2[InvoiceDate] ), [InvoiceDate] ), "MMMM DD, YYYY" )Regards,
Xiaoxin Sheng
HI sanimesa,
I'm not so sure why firstdate and lastdate function not works on your side. (I test with last version without any issue)
Can you please share pbix file to test?
In addition, you can also try to use below formula to instead:
Invoice Date Selected =
"Reporting Period: "
& FORMAT (
MINX ( ALLSELECTED ( InvoiceTable[InvoiceDate] ), [InvoiceDate] ),
"MMMM DD, YYYY"
)
& " - "
& FORMAT (
MAXX (
ALLSELECTED ( Reporting_JSG_ConsolidatedOrders[InvoiceDate] ),
[InvoiceDate]
),
"MMMM DD, YYYY"
)
Regards,
Xiaoxin Sheng
Anonymous
Uploaded a sample below:
https://1drv.ms/u/s!AqfAbaFIezosba5FPnh8QNoUwxM
This contains two examples, one set works, the other does not. It is probably data related but can't figure out why.
- sanimesa8 years ago
Post Prodigy
Anonymous Just wondering if you had a chance to look at this.
- Anonymous8 years agoNot applicable
The error message is pretty clear. You can't use a column that contains the same date value multiple times in these functions. They're meant to be used on a date dimension table. If you're using a fact table where the same date can be repeated more than once, you should use MIN and MAX instead.
- sanimesa8 years ago
Post Prodigy
Anonymous I have duplicate dates in both sets in my example, one is working while the other is not. Additionally, this used to work before on the same dataset. I guess I will try and use some other method but I have a feeling the May upgrade caused it.