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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
pras_hant10
Frequent Visitor

Using earlier with direct query (SQL)

Hi Team,

 

I am trying to get the latest date from the table, based on created date time, which I was able to achive in table based data source, but same are getting failed when using the Direct Query. Below are the details:

 

MaxDate = CALCULATE(max(Reports1[created]),FILTER(Reports1,Reports1[ticker]=EARLIER(Reports1[ticker])))
LatestDate = If(Reports1[created]=[MaxDate],"Latest","Older")
 
Above formulas are not working with direct query data. Please suggest.
2 REPLIES 2
amitchandak
Super User
Super User

@pras_hant10 , You can not use earlier in case on direct query column

 

try a measure like

 

CALCULATE(max(Reports1[created]),FILTER(allselected(Reports1),Reports1[ticker]=max(Reports1[ticker])))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

I am unable to achive the same request, as in the blue area. While using new formula. (Measures)

Screenshot 2021-08-12 175038.jpg

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

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