The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have put this dax together.
Solved! Go to Solution.
Hi @yolandacb ,
I created a sample pbix file(see the attachment), please check if that is what you want.
YTD AC =
CALCULATE (
SUM ( 'Append'[Value] ),
FILTER (
'Append',
'Append'[view] = "actuals"
&& YEAR ( 'Append'[Date] ) = YEAR ( TODAY () )
&& 'Append'[Date] <= TODAY ()
)
)
Best Regards
@yolandacb , use the below measure
the reason why iam choosing this measure , if it is more 1 filters then you have to use datesytd function forperfamnace . please check the below one
YTD =
CALCULATE(
SUM('Append'[Value]),
'Append'[view] = "actuals",
DATESYTD('FinDate'[Date])
)
or use below one
YTD AC =
CALCULATE(
SUM('Append'[Value]),
'Append'[view] = "actuals",
DATESYTD('FinDate'[Date])
)
please accept if my measure will works
Hi @yolandacb ,
Please update the formula of measure as below and check if it can return the expected result...
YTD AC =
TOTALYTD (
SUM ( 'Append'[Value] ),
'Append'[Date],
FILTER (
ALLSELECTED ( 'Append' ),
'Append'[view] = "actuals"
&& 'Append'[Date] < TODAY ()
)
)
Best Regards
Sorry, let me clarify.
My table has dates in the future. That's why I keep getting the values in the future. I realised that I need a measure that calculated the YTD to a point in time.
Hi @yolandacb ,
I created a sample pbix file(see the attachment), please check if that is what you want.
YTD AC =
CALCULATE (
SUM ( 'Append'[Value] ),
FILTER (
'Append',
'Append'[view] = "actuals"
&& YEAR ( 'Append'[Date] ) = YEAR ( TODAY () )
&& 'Append'[Date] <= TODAY ()
)
)
Best Regards
Hi, @yolandacb
try below measure
MEASURE =
CALCULATE (
[value],
'Append'[view] = "actuals",
keepfilter ( 'FinDate'[Date] < TODAY () )
)
Best Regards,
Dangar
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Sorry I tried this, but I still get the whole year, rather than until the current month.
Corrected DAX Measure:
YTD AC =
CALCULATE(
SUM('Append'[Value]),
'Append'[view] = "actuals",
DATESYTD('FinDate'[Date])
)
💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn
Sorry I tried this, but I still get the whole year, rather than until the current month.
Hi @yolandacb
The issue arises because the TOTALYTD function isn't dynamically filtering the dates based on the year-to-date (YTD) range due to the way you structured your DAX formula. Specifically, the FILTER function within SUMX evaluates the entire table, effectively ignoring the TOTALYTD filter context.
Here’s what is missing and how to fix it:
You need to make sure that the filtering for YTD is applied correctly. Replace your measure with the following:
YTD AC =
CALCULATE(
SUMX(
'Append',
IF('Append'[view] = "actuals", [Value], 0)
),
DATESYTD('FinDate'[Date], "31/12")
)
To see which rows are contributing to your calculation, you can create a debugging table:
EVALUATE
CALCULATETABLE(
FILTER('Append', 'Append'[view] = "actuals"),
DATESYTD('FinDate'[Date], "31/12")
)
This will show the filtered rows for YTD, helping you verify that the filters are applied correctly.
Let me know if you encounter any issues!
Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂
Kind Regards,
Poojara
Data Analyst | MSBI Developer | Power BI Consultant
YouTube: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS
User | Count |
---|---|
25 | |
12 | |
8 | |
8 | |
7 |
User | Count |
---|---|
28 | |
13 | |
12 | |
12 | |
6 |