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

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/

 

 

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

 

 


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.