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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

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])))

Share with Power BI Enthusiasts: 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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.