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
Anonymous
Not applicable

Showing data with most recent date based on two columns

Hi all,

 

I would like to be able to show all companies, per database the version they are running on.

So in other words see company 'B', instead of seeing the 17 rows as shown in excel, in Power BI I would like to see just 3 rows of of the 3 different databases with the most recent version they are working on. In other words using the 'Date' column it should only show the most recent update. 

So in this case I would end up with 4 rows of data, Company A = 1 row and Company B = 3 rows with the latest date and its version. Please help!

CompanyDatabaseVersionDate
ANAV100Ont4PSNL 10.00-011-286-2-2018
ANAV100Ont4PSNL 10.00-011-286-2-2018
ANAV100Ont4PSNL 10.0-011-2915-2-2018
ANAV100Ont4PSNL 10.0-011-2915-2-2018
ANAV100Ont4PSNL 10.0-013-137-3-2018
ANAV100Ont4PSNL 10.0-013-149-4-2018
BNAV100Test4PSNL 10.00-012-1024-8-2017
BNAV100Test4PSNL 10.00-012-126-9-2017
BNAV100Prod4PSNL 10.00-012-1211-9-2017
BNAV100Test4PSNL 10.00-012-1415-9-2017
BNAV100Prod4PSNL 10.00-012-1420-9-2017
BNAV100Test4PSNL 10.00-012-162-10-2017
BNAV100Prod4PSNL 10.00-012-169-10-2017
BNAV100Test4PSNL 10.00-012-2224-11-2017
BNAV100Prod4PSNL 10.00-012-2224-11-2017
BNAV100Test4PSNL 10.00-012-2512-1-2018
BNAV100Test4PSNL 10.00-013-0615-1-2018
BNAV100Prod4PSNL 10.00-012-2522-1-2018
BNAV100DSG4PSNL 10.00-014-0027-1-2018
BNAV100DSG4PSNL 10.00-014-0013-3-2018
BNAV100DSG4PSNL 10.00-014-0213-3-2018
BNAV100Prod4PSNL 10.00-014-0325-4-2018
BNAV100DSG4PSNL 10.00-014-0722-6-2018
1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Anonymous Please create following measure to get the latest update record.

IsLatest = 
VAR _latestDate = CALCULATE(MAX('Table'[Date]),ALLEXCEPT('Table','Table'[Company],'Table'[Database]))
RETURN IF(MAX('Table'[Date])=_latestDate,TRUE(),FALSE())

 In case you want a separate table then create a measure in original table and go to modeling tab and create a table with below formula

Table 2 = FILTER('Table',[Measure]=TRUE())

 

View solution in original post

9 REPLIES 9
az38
Community Champion
Community Champion

Hi @Anonymous 

or try new table

Table = summarize(Table1;Table1[Company];Table1[Database];"Last Version";MAX(Table1[Version]))

it will be correct if versions order are sorted by its names

do not hesitate to give a kudo to useful posts and mark solutions as solution
Linkedin


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

@Anonymous Please create following measure to get the latest update record.

IsLatest = 
VAR _latestDate = CALCULATE(MAX('Table'[Date]),ALLEXCEPT('Table','Table'[Company],'Table'[Database]))
RETURN IF(MAX('Table'[Date])=_latestDate,TRUE(),FALSE())

 In case you want a separate table then create a measure in original table and go to modeling tab and create a table with below formula

Table 2 = FILTER('Table',[Measure]=TRUE())

 

Anonymous
Not applicable

@Anonymous 

This doesn't seem to look at the separate databases and as you can see doesn't fully work as e.g. with the second customer there is no date with 'True'. I would need 3 True's for the three different databases with the latest date. Thanks for thinking this through!

See here the result 

 

Anonymous
Not applicable

@Anonymous can you please confirm if this is the expected result?

LatestDB.png

Anonymous
Not applicable

@Anonymous That is indeed what I need. Perhaps I'm doing something wrong, my measure is:

 
IsLatest =
VAR _latestDate = CALCULATE(MAX('Sharepoint Changelog'[Date]);ALLEXCEPT('Sharepoint Changelog';'Sharepoint Changelog'[Company];'Sharepoint Changelog'[Database]))
RETURN IF(MAX('Sharepoint Changelog'[Date])=_latestDate;TRUE();FALSE())

 

Where the Sharepoint Changelog is the source. The first customer with one database is done correctly, second company I get no True's and third company is incorrect... See here my result

Anonymous
Not applicable

@Anonymous Can you please check if the data type of Sharepoint Changelog'[Date] column is date or not? Data type should be date

Anonymous
Not applicable

@Anonymous 

See here my result 

It was indeed data type text, so I've changed that to 'Date' and it has made some aspects true, but for the second customer does show one 'True' now but I need three for the three differen database types with the most recent date. So still shows incorrect True statements... Perhaps I'm still doing something wrong. Thanks for looking into it.

az38
Community Champion
Community Champion

Hi @Anonymous didnt solution with summarize function satisfy you?

 

do not hesitate to give a kudo to useful posts and mark solutions as solution
Linkedin


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

@az38  See here the result 

This doesn't correspond, it shows the wrong databases with the wrong companies...

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.

Top Solution Authors