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.
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
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!
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/
Perhaps:
Measure =
VAR __Fund = MAX('Table'[Fund])
VAR __Date = MINX('Table',[Date])
RETURN
MAXX(
FILTER(
'Table',
'Table'[Fund] = __Fund &&
'Table'[Date] = __Date
),
[Return]
)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
115 | |
100 | |
88 | |
68 | |
61 |
User | Count |
---|---|
150 | |
120 | |
100 | |
87 | |
68 |