Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi All,
I'm trying to calculate YTD and make the values stop at EOMONTH (Today()) by default.= (i.e. without the month slicer being selected, it should show you YTD up till end of this month). If a slicer is selected, then i want the YTD value to be as at the month selected. i.e. sum of all sales until and including the month selected.
My formula at the moment is
Var YTD_Sales = TotalYTD(SUM(Sales[Amount]), DimDate[Date])
RETURN
IF(MAX(DimDate[Date]) <= EOMONTH (TODAY(),0), YTD_Sales)
I get a BLANK() when no slicer is selected. I want, however, the card to still be populated and show YTD till EOM but then if i select a prior month, it will also show YTD up till and including month selected.
Thanks in advance
Solved! Go to Solution.
@Anonymous Try this:
var YTD_Sales=CALCULATE(SUM(Sales[Amount]),DATESYTD(DimDate[Date]))
var YTD_Sales_Today=CALCULATE(SUM(Sales[Amount]),DATESBETWEEN(DimDate[Date],DATE(YEAR(TODAY()),1,1),EOMONTH(TODAY())))
return IF(MAX(DimDate[Date]) <= EOMONTH (TODAY(),0), YTD_Sales,YTD_Sales_Today)
@Anonymous Try this:
var YTD_Sales=CALCULATE(SUM(Sales[Amount]),DATESYTD(DimDate[Date]))
var YTD_Sales_Today=CALCULATE(SUM(Sales[Amount]),DATESBETWEEN(DimDate[Date],DATE(YEAR(TODAY()),1,1),EOMONTH(TODAY())))
return IF(MAX(DimDate[Date]) <= EOMONTH (TODAY(),0), YTD_Sales,YTD_Sales_Today)
That worked perfectly! thank you so much!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
144 | |
85 | |
65 | |
51 | |
45 |
User | Count |
---|---|
217 | |
88 | |
81 | |
65 | |
56 |