Forum Discussion
DAX date issue - earliest date and record
- 1 year ago
Hi Dinesh, I've managed to resolve this issue. I actually ended up reworking the data model a little bit which I meant I could leverage some of the out of the box time intelligence functions a bit more easily.
Thanks
Hi Jsummersgill86 ,
Thank you for reaching out to the Microsoft Community Forum.
I have done some changes in your DAX measures. In additionally i have created "Initial Estimate Value", "Prior Estimate Value", "Current Estimate Value" and "Change in Estimate" measures with sample syntax.
1.
Most Recent Date =
CALCULATE(
MAX(FACT[Est_Dt]),
ALLEXCEPT(FACT, FACT[OfficeID])
)
Note: It calculates per OfficeID within the filter context.
2.
First Release Date =
CALCULATE(
MIN(FACT[Est_Dt]),
ALLEXCEPT(FACT, FACT[OfficeID])
)
3.
Initial Estimate Value =
CALCULATE(
SUM(FACT[Est_rev]),
FILTER(
ALL(FACT),
FACT[Est_Dt] = CALCULATE(MIN(FACT[Est_Dt]), ALLEXCEPT(FACT, FACT[OfficeID]))
)
)
4. Assume your Date table is used in slicers, and slicer is filtering for last 2 months, you can use below measure
Prior Estimate Value =
VAR StartDate =
MIN(DIM_DATE[Date])
VAR PriorDate =
CALCULATE(
MAX(FACT[Est_Dt]),
FILTER(
ALL(DIM_DATE),
DIM_DATE[Date] < StartDate
),
ALLEXCEPT(FACT, FACT[OfficeID])
)
RETURN
CALCULATE(
SUM(FACT[Est_rev]),
FILTER(
ALL(FACT),
FACT[Est_Dt] = PriorDate
)
)
5.
Current Estimate Value =
VAR MaxEstNum =
CALCULATE(
MAX(FACT[Est_Num]),
ALLEXCEPT(FACT, FACT[OfficeID])
)
RETURN
CALCULATE(
SUM(FACT[Est_rev]),
FILTER(
FACT,
FACT[Est_Num] = MaxEstNum
)
)
6.
Change in Estimate = [Current Estimate Value] - [Prior Estimate Value]
I hope this information helps. Please do let us know if you have any further queries.
Regards,
Dinesh
Hi Jsummersgill86 ,
We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. And, if you have any further query do let us know.
Regards,
Dinesh
- v-dineshya1 year ago
Community Support
Hi @Jsummersgill86 ,
We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. And, if you have any further query do let us know.
Regards,
Dinesh
- Jsummersgill861 year agoNew Member
Hi Dinesh, I've managed to resolve this issue. I actually ended up reworking the data model a little bit which I meant I could leverage some of the out of the box time intelligence functions a bit more easily.
Thanks
- v-dineshya1 year ago
Community Support
Hi Jsummersgill86 ,
If your issue is resolved, Please share the details here and mark it as 'Accept as solution' to assist others with similar issues. If it did not, please provide further details.
Regards,
Dinesh