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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
SNV
Helper I
Helper I

FIRSTDATE and LASTDATE

Hello community,

 

Building on a previous solution for an answer, I'm using FIRSTDATE and LASTDATE to get the first and most recent occuring date.

Problem is, whenever I use a date slicer to narrow the range, some dates don't change. So if I set the slicer to 1-1-2017 through 31-12-2017, a date for 1-1-2015 will still be returned.

The code I use for finding the minimum date is:

 

Minimum Date = CALCULATE(FIRSTDATE('Table'[Date]);ALLEXCEPT('Table';'Table'[Group];'Table'[ID]))

Then I use that measure for calculating an average with this code:

AVG MIN DATE = 
VAR Tbl2 =
SUMMARIZE(
FILTER('Table';'Table'[Date]='ZRM TEST QUERY'[Minimum Date]);'Table'[Group];'Table'[ID];"AVG_PER_ID_ON_MIN_DATE";AVERAGE('Table'[SCORE]))RETURN AVERAGEX(Tbl2;[AVG_PER_ID_ON_MIN_DATE])

But for some ID's it returns the incorrect average because of the mistake with the minimumdate.

 

Any help would be much appreciated

 

 

10 REPLIES 10

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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