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

Preparing for a certification exam? Ask exam experts all your questions on May 15th. Register now.

Reply
Anonymous
Not applicable

How to find the sales value from last year's first transaction ( first date)?

Hi all,

I have a dataset with date column and fund retun values. For a given a fund we might have a few years of history or a few months. I need a measure to return the earliest return value from the last year. 

Assume for a given Fund we have a single return per day.

If the fund has historical data in the dataset prior to 1/1/2019 then I need the return value for 1/1/2019, but if the earliest data is from lets say 6/20/2019 then I need the return value for that date.

 

I would appreciate your help in DAX formula     

 

3 REPLIES 3
v-diye-msft
Community Support
Community Support

Hi @Anonymous 

 

If you've fixed the issue on your own please kindly share your solution. if the above posts help, please kindly mark it as a solution to help others find it more quickly.thanks!

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
amitchandak
Super User
Super User

Make sure you have date calendar map to your Table and Try

Last YTD Sales = CALCULATE(min(Transaction[Date]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
Last YTD complete Sales = CALCULATE(min(Transaction[Date]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))

Last YTD complete Sales = CALCULATE(min(Transaction[Date]),filter(all('Date'),year('Date'[Date]) =year(today())-1))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

 

 

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

Perhaps:

 

Measure =
  VAR __Fund = MAX('Table'[Fund])
  VAR __Date = MINX('Table',[Date])
RETURN
  MAXX(
    FILTER(
      'Table',
      'Table'[Fund] = __Fund &&
        'Table'[Date] = __Date
    ),
    [Return]
   )

 

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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