March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello,
I need a YTD measure that calculates the revenue of a year only until the actual day (today) and not beyond if there are data.
My measure still calculates til end of year, whether it's displayed on a table or in a card.
In this example the measure's result should be 1.389.000, because today is Oct 29th and the last date with revenue is Oct 28th, given that I selected year 2020.
Thank you a lot!
Solved! Go to Solution.
Hi @thhmez7 ,
When you use silcer ,slicer only filter the vusual ,and not work on the measure you created.
You could try the following measure:
Actual Revenue YTD3 =
VAR day1 =
DATE ( YEAR ( TODAY () ) - 1, MONTH ( TODAY () ), DAY ( TODAY () ) )
VAR v1 =
CALCULATE (
SUM ( Project[Actual Revenue] ),
FILTER ( ALL ( 'Date' ), 'Date'[Date] <= day1 )
)
RETURN
IF(MAX(Project[date])<>BLANK(), IF (
MAX ( 'Date'[Date] ) <= day1 ,
CALCULATE (
SUM ( Project[Actual Revenue] ),
FILTER ( ALL ( 'Date' ), 'Date'[Date] <= MAX ( 'Date'[Date] ) )
),
v1
),BLANK())
Did I answer your question? Mark my post as a solution!
Best Regards
Lucien
Hi @thhmez7 ,
Has your problem been solved, if so, please consider Accept a correct reply as the solution or share your own solution to help others find it.
Best Regards
Lucien
Hi,
Ensure you have a Calendar Table with columns for Year, Month name and Month number. Sort the Month Name by the Month number. To your slicer, drag the Year from the Calendar Table. To your visual, drag the Month name or date from the Calendar Table. Write these measures:
Revenue = sum(project[actual revenue])
YTD revenue till date = calculate([revenue],datesbetween(calendar[date],minx(allexcept(calendar[year]),calendar[date]),today()))
Hope this helps.
Hi @thhmez7 ,
When you use silcer ,slicer only filter the vusual ,and not work on the measure you created.
You could try the following measure:
Actual Revenue YTD3 =
VAR day1 =
DATE ( YEAR ( TODAY () ) - 1, MONTH ( TODAY () ), DAY ( TODAY () ) )
VAR v1 =
CALCULATE (
SUM ( Project[Actual Revenue] ),
FILTER ( ALL ( 'Date' ), 'Date'[Date] <= day1 )
)
RETURN
IF(MAX(Project[date])<>BLANK(), IF (
MAX ( 'Date'[Date] ) <= day1 ,
CALCULATE (
SUM ( Project[Actual Revenue] ),
FILTER ( ALL ( 'Date' ), 'Date'[Date] <= MAX ( 'Date'[Date] ) )
),
v1
),BLANK())
Did I answer your question? Mark my post as a solution!
Best Regards
Lucien
Hi Thank you for replicating this case. I tried your calculation. But still doesn't show the result of yours. Can you look into it?
Hi @thhmez7 ,
The following is relationship in my case .
And could you pls share your pbix file through a public link that I could test on your sample? Remember to remove confidential data.
Best Regards
Lucien
@thhmez7 , Try like these with help from date tbale
YTD Corrected =
var _max = format(today(),"MMDD")
return
calculate(Sum('order'[Qty]),DATESYTD('Date'[Date]),format('Date'[Date],"MMDD")<=_max)
LYTD Corrected =
var _max = format(today(),"MMDD")
return
calculate(Sum('order'[Qty]),DATESYTD(dateadd('Date'[Date],-1,year)),format('Date'[Date],"MMDD")<=_max)
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
89 | |
84 | |
70 | |
51 |
User | Count |
---|---|
206 | |
143 | |
97 | |
79 | |
68 |