Forum Discussion
Format a text value to look like a date value in DirectQuery
Hello everyone,
I have a DQ model, which means I can't use the FORMAT function. I needed to create a calculated column of type "Text" to store a bucket of date values, along with a text value of "Past Due", see below:
Hi Anonymous
I can reproduce your problem.
Please create columns
Column = MONTH([Week Due])&"/"&DAY([Week Due])&"/"&YEAR([Week Due]) Week Due Bucket2 = IF([This Week] > [Week Due], "Past Due", [Column])
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 Replies
- v-juanli-msftCommunity Support
Hi Anonymous
Which is the [this week] ?
I test as below, but i can't reproduce your problem.
Please share a example as above and how does the "this week" calculate?
Best Regards
Maggie
- AnonymousNot applicable
This Week return a single date value - the sunday of the current week.
This Week = TODAY() - WEEKDAY(TODAY(), 1)+1Week Due = 'Date'[DateKey] - WEEKDAY('Date'[DateKey], 1)+1 --column data type DateWeek Due String = LEFT('Date'[DateKey] - WEEKDAY('Date'[DateKey], 1)+1, 11) -- column data type of TextWeek Due Bucket = IF([This Week] > [Week Due], "Past Due", [Week Due String]) -- column data type of Text to allow for "Past Due" as a possible value.
- v-juanli-msftCommunity Support
Hi Anonymous
I can reproduce your problem.
Please create columns
Column = MONTH([Week Due])&"/"&DAY([Week Due])&"/"&YEAR([Week Due]) Week Due Bucket2 = IF([This Week] > [Week Due], "Past Due", [Column])
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.- AnonymousNot applicable
Perfect, thanks Maggie!