Forum Discussion
robertomari2020
Helper I
6 years agoShow only the value for the current Year
Hi everyone, I think I have a pretty simple question. How do I have to change this measure in order to ONLY show values for the current year? (I want to show the accumulated values of the c...
v-kelly-msft
Community Support
6 years agoHi robertomari2020 ,
Create a measure similarly as below:
Measure =
Var _year=YEAR(TODAY())
Return
CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),'Table'[Date]<=MAX('Table'[Date])&&YEAR('Table'[Date])=_year))
And you will see:
In you case,you may try below dax expression:
ShowOnlyValueForCurrentYear =
VAR maxWeek = CALCULATE(MAX('Calendar'[CalendarWeek]),ALL('Calendar'))
VAR maxYear = CALCULATE(MAX('Calendar'[Year]),ALL('Calendar'))
RETURN
CALCULATE(
[Total Value Orders];
ALL('Calendar'[CalendarWeek]);
FILTER(ALL('Calendar'[Year]); 'Calendar'[Year] = maxYear);
'Calendar'[CalendarWeek] <= maxWeek
)
I made a sample .pbix file if needed.
Best Regards,
Kelly
Kelly
Did I answer your question? Mark my post as a solution!
robertomari2020
Helper I
6 years agoHi v-kelly-msft ,
I tried your suggested code, but still getting the same problem. It takes the value of 2019 and also shows this in 2020. (but 2020 should be empty, because I only have values in 2019)
Unfortunately I also couldn't open your file - getting this error message:
Object reference not set to an instance of an object.
Thanks for your help so far!
- v-kelly-msft6 years ago
Community Support
Hi robertomari2020 ,
Could you pls upload your .pbix file to onedrive business and share the link with me?I will write the calculation according to your data.
Much appreciated.
Best Regards,
KellyDid I answer your question? Mark my post as a solution!