cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Borghi
Advocate I
Advocate I

Summarising Max Date and First Occurence of a Value

Hi folks,

 

I am having some hard times with SUMMARIZE().

I have a dataset with 3 columns: ID, Date and Value

Original DatasetOriginal Dataset

I am trying to create a new table using the SUMMARIZE() function, as the following:

 

TopDate = SUMMARIZE('Static', 'Static'[ID], "MaxDate", MAX('Static'[Date]), "NewValue", FIRSTNONBLANK('Static'[Value], MAX('Static'[Date])))

 

It is returning the following dataset:

Actual DatasetActual Dataset

However, it was suppose to get the following:

ToBe DatasetToBe Dataset

Anyone have an idea why am I getting the values from a sorted order, even if I am choosing FIRSTNONBLANK() from MAX('Static'[Date])?

 

Thanks,

1 ACCEPTED SOLUTION
Zubair_Muhammad
Super User
Super User

HI @Borghi

 

Try using this

 

TopDate =
SUMMARIZE (
    'Static',
    'Static'[ID],
    "MaxDate", MAX ( 'Static'[Date] ),
    "NewValue", CALCULATE ( FIRSTNONBLANK ( 'Static'[Value], 1 ), LASTDATE ( 'Static'[Date] ) )
)

Regards
Zubair

Please try my custom visuals

View solution in original post

2 REPLIES 2
Zubair_Muhammad
Super User
Super User

HI @Borghi

 

Try using this

 

TopDate =
SUMMARIZE (
    'Static',
    'Static'[ID],
    "MaxDate", MAX ( 'Static'[Date] ),
    "NewValue", CALCULATE ( FIRSTNONBLANK ( 'Static'[Value], 1 ), LASTDATE ( 'Static'[Date] ) )
)

Regards
Zubair

Please try my custom visuals

Hi @Zubair_Muhammad,

 

It worked!

 

Thanks a million! Smiley Happy

Helpful resources

Announcements
May 23 2022 epsiode 5 without aka link.jpg

The Power BI Community Show

Welcome to the Power BI Community Show! Jeroen ter Heerdt talks about the importance of Data Modeling.

charticulator_carousel_with_text (1).png

Charticulator Design Challenge

Put your data visualization and design skills to the test! This exciting challenge is happening now through June10th!

Power BI Dev Camp Session 22 without aka link and time 768x460.jpg

Check it Out!

Watch Session 22 Ted's Dev Camp along with past sessions!

Power BI Release May 2022 768x460.png

Check it out!

Click here to read more about the May 2022 updates!

Top Kudoed Authors