Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
hanzfunny
Frequent Visitor

Reporting the outcome recorded for the max date within the reporting period

I need to be able to say the outcome recorded for the max date within the reporting period. The max date sits on 1 table and the outcome on another table. 

 

I have the max date:

DRAFT Accomodation situation at end of reporting period? =

var _enddatecontext=MAX('transform DimCalendar'[ActualDate])

Return

CALCULATE(

MAX('dl FactCATServiceReview'[CATServiceReviewReviewDate])

,FILTER('dl FactCATServiceReview',

('dl FactCATServiceReview'[CATServiceReviewReviewDate]<=_enddatecontext)))

 

But then I need to say look at the related table and return the status text.

Linking column [AccommodationStatusID]

Table: dl_DimCATReviewAccommodationStatus

Column: [CATReviewAccommodationStatusText]

1 ACCEPTED SOLUTION
hanzfunny
Frequent Visitor

SOLVED.
I merged the tables to exclude the related table look-up problem.
Then turned the calculation into a variable. 

DRAFT Accomodation End =

var _enddatecontext=MAX('transform DimCalendar'[ActualDate])

var _MaxDate=CALCULATE(MAX('dl FactCATServiceReview'[CATServiceReviewReviewDate]),FILTER('dl FactCATServiceReview','dl FactCATServiceReview'[CATServiceReviewReviewDate]<=_enddatecontext))

var _Result=

CALCULATE(MAX('dl FactCATServiceReview'[AccommodationSituation]),'dl FactCATServiceReview'[CATServiceReviewReviewDate]=_MaxDate)

 

RETURN

_Result

 

View solution in original post

1 REPLY 1
hanzfunny
Frequent Visitor

SOLVED.
I merged the tables to exclude the related table look-up problem.
Then turned the calculation into a variable. 

DRAFT Accomodation End =

var _enddatecontext=MAX('transform DimCalendar'[ActualDate])

var _MaxDate=CALCULATE(MAX('dl FactCATServiceReview'[CATServiceReviewReviewDate]),FILTER('dl FactCATServiceReview','dl FactCATServiceReview'[CATServiceReviewReviewDate]<=_enddatecontext))

var _Result=

CALCULATE(MAX('dl FactCATServiceReview'[AccommodationSituation]),'dl FactCATServiceReview'[CATServiceReviewReviewDate]=_MaxDate)

 

RETURN

_Result

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.