Forum Discussion
when creating a measure using a date table the date column is not recognized
I have a date table marked as a date table with a column called date. I want to create a measure to compare YTD record totals to LYTD record totals. The first measure I want to create is:
Hello smmoore34
If your date table is already marked as Date Table (If not, in Modeling 'Mark as Date Table'), then use below time intelligence function,
YTD=
TOTALYTD(
DISTINCTCOUNT('CIVIL_AssignedOnly'[callid]),
'DATE'[Date]
)LYTD =
CALCULATE(DISTINCTCOUNT('CIVIL_AssignedOnly'[callid]),SAMEPERIODLASTYEAR('DATE'[Date]))
7 Replies
- MasonMA
Super User
Hello smmoore34
If your date table is already marked as Date Table (If not, in Modeling 'Mark as Date Table'), then use below time intelligence function,
YTD=
TOTALYTD(
DISTINCTCOUNT('CIVIL_AssignedOnly'[callid]),
'DATE'[Date]
)LYTD =
CALCULATE(DISTINCTCOUNT('CIVIL_AssignedOnly'[callid]),SAMEPERIODLASTYEAR('DATE'[Date])) - Ashish_Mathur
Super User
Hi,
Try this measure
YTD_total = calculate(DISTINCTCOUNT ( 'CIVIL_AssignedOnly'[callid] ),datesytd('DATE'[Date]))Hope this helps.
- Shahid12523
Community Champion
You can’t just put 'DATE'[Date] in a measure. Use time-intelligence functions:
YTD:
YTD_total =
CALCULATE(
DISTINCTCOUNT('CIVIL_AssignedOnly'[callid]),
DATESYTD('DATE'[Date])
)
LYTD:LYTD_total =
CALCULATE(
DISTINCTCOUNT('CIVIL_AssignedOnly'[callid]),
DATESYTD(SAMEPERIODLASTYEAR('DATE'[Date]))
)
✅ Make sure the Date table is marked as a date table and related properly. - AnonymousNot applicable
Hi smmoore34 ,
Thank you for reaching out to the Microsoft fabric community forum.
Could you please confirm if the issue has been resolved. I wanted to check if you had the opportunity to review the information provided by MasonMA , Ashish_Mathur and Shahid12523 helpful for you to resolve your issue. Please feel free to contact us if you have any further questions.
Thank you.
- AnonymousNot applicable
Hi smmoore34 ,
Could you please confirm if the issue has been resolved. Please feel free to contact us if you have any further questions.
Thank you.