Forum Discussion
YTD for calculated values not working
- 2 years ago
superjam Here you go:
Measure = VAR __MesAnoNUm = MAX('Calendar'[MesAñoNum]) VAR __Table = FILTER ( SUMMARIZE( ALLSELECTED('Calendar'), [MesAño], [MesAñoNum], "__Value", [Revenue month] ), [MesAñoNum] <= __MesAnoNum ) VAR __Result = SUMX( __Table, [__Value] ) RETURN __Result
superjam It's hard to tell if this is right or not because I don't think the sample data provided matches up with the result you posted. But try this. PBIX is attached below signature. I had to change your Initial Balance formula because yours didn't work for me.
YTD =
VAR __MaxDate = MAX('Calendar'[Date])
VAR __Table =
SUMMARIZE(
FILTER(
ALL('Movements'),
[Date] <= __MaxDate
),
[Date],
"__YTD", [Revenue Month]
)
VAR __Result = SUMX( __Table, [__YTD])
RETURN
__Result
Thank you so much, Greg_Deckler .
I copied your YTD formula and only adapted it to match table and field names in my database. Unfortunaltely it did not work. I must have something different in my data logic!
In your pbix I see everything like explained.
¿How can I upload a pbix file?
Thanks and regards
- superjam2 years ago
Helper II
Hello, Greg_Deckler , mickey64 , Ashish_Mathur
Here is an extract of my project:
Thank you again and regards,
- Greg_Deckler2 years ago
Community Champion
superjam Here you go:
Measure = VAR __MesAnoNUm = MAX('Calendar'[MesAñoNum]) VAR __Table = FILTER ( SUMMARIZE( ALLSELECTED('Calendar'), [MesAño], [MesAñoNum], "__Value", [Revenue month] ), [MesAñoNum] <= __MesAnoNum ) VAR __Result = SUMX( __Table, [__Value] ) RETURN __Result- superjam2 years ago
Helper II
Hello Greg_Deckler
You rock!! It worked fine. THANK YOU very much.
Now it is my turn to discover and learn how you did it (and why otherwise it did not work).
And I think I will by your book. Really.
Kind regards.