Forum Discussion
superjam
Helper II
2 years agoYTD for calculated values not working
Hello PowerBI experts! I have 3 tables: 1. Balances Investment balances for each month, like so: Date Final Balance 31-12-22 100.000 31-01-23 101.000 28-...
- 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
Greg_Deckler
Community Champion
2 years agosuperjam 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
- superjam2 years ago
Helper II
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