Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Return Date based on Conditions from same table
07-31-2023
03:32 AM
Hi, i've been trying to follow this: Solved: Date difference between values in same column - Microsoft Fabric Community
Since I want to get a similar result. I need to calculate the difference in days from the BaselineDate to Forecast Date for each unique ID to determine if items are running on schedule (The dataset is incomplete - not all IDs have dates set) . I have the following [Master] table:
with the calculated column:
DiffBaselineForcast_days =
VAR _ID = Master[UniqueID]
VAR temp =
TOPN (
1,
FILTER (
Master,
Master[UniqueID] = _ID
&& Master[EntryType] = "ForecastDate"
),
[Date], DESC
)
RETURN
if(Master[EntryType] = "BaselineDate",DATEDIFF(MAXX(temp,[Date]),[Date],DAY),0)
Which seems to be working however can someone explain it to me as I'm struggling to understand how it is working
I'm confused with the MAXX part and that when i try and return temp[Date] it says its not a table?
or suggest a simpler way of calculating this??
Thanks!
Solved! Go to Solution.
1 ACCEPTED SOLUTION
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023
06:34 AM

After going away and coming back to it I've decided a new approach which I think works better:
Late2 =
VAR varCurrentScenarioID = Master[UniqueID]
VAR varCurrentEntryType = Master[EntryType]
VAR varCurrentDate = Master[Date]
VAR DateDifference =
IF(
varCurrentEntryType = "ForecastDate",
DATEDIFF(varCurrentDate,
LOOKUPVALUE(Master[Date],Master[UniqueID],varCurrentScenarioID,Master[EntryType],"BaselineDate"),
DAY),
blank()
)
VAR Result =
IF(DateDifference < 0, "Late",BLANK())
RETURN
Result
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023
06:34 AM

After going away and coming back to it I've decided a new approach which I think works better:
Late2 =
VAR varCurrentScenarioID = Master[UniqueID]
VAR varCurrentEntryType = Master[EntryType]
VAR varCurrentDate = Master[Date]
VAR DateDifference =
IF(
varCurrentEntryType = "ForecastDate",
DATEDIFF(varCurrentDate,
LOOKUPVALUE(Master[Date],Master[UniqueID],varCurrentScenarioID,Master[EntryType],"BaselineDate"),
DAY),
blank()
)
VAR Result =
IF(DateDifference < 0, "Late",BLANK())
RETURN
Result

Helpful resources
Recommendations
Subject | Author | Posted | |
---|---|---|---|
02-17-2024 11:15 AM | |||
02-15-2024 06:44 AM | |||
07-02-2024 07:09 AM | |||
Anonymous
| 04-02-2024 06:27 AM | ||
07-27-2023 09:20 AM |
Featured Topics
Top Kudoed Authors (Last Month)
User | Count |
---|---|
117 | |
96 | |
83 | |
55 | |
46 |