Forum Discussion
Monthly Distribution from year
Rasmus7700
Please try this measure. If this doesn't work, can share a dummy PBIX file, it will be helpful to understand your data model.
Test - Budget =
VAR SelectedYear =
SELECTEDVALUE ( 'Dim.Kalender'[År #] )
VAR SelectedMonth =
SELECTEDVALUE ( 'Dim.Kalender'[Måned #] )
VAR YearlyBudget =
SUMX (
FILTER (
'Finans - Kontoplan - Finansposter - Fact',
'Finans - Kontoplan - Finansposter - Fact'[Bogførings Dato]
>= DATE ( SelectedYear, 1, 1 )
&& 'Finans - Kontoplan - Finansposter - Fact'[Posteringstype (Budget / Realiseret)] = "Budget"
),
'Finans - Kontoplan - Finansposter - Fact'[Total Beløb (Debet / Kredit)]
)
VAR MonthlyDistribution =
SWITCH (
SelectedMonth,
1, 1,
2, 1.1,
3, 1.1,
4, 1,
5, 1.1,
6, 1,
7, 0.85,
8, 0.85,
9, 1,
10, 1.1,
11, 1.1,
12, 0.8,
0
)
RETURN
CALCULATE ( DIVIDE ( YearlyBudget, 12 ) * MonthlyDistribution )
The solution is working like ot should for one month - here it get's the correct values like intended...
The problem is that the value where i am getting the "Budget" value from is only represented once in my raw data with a timestamp like "01-01-2024" - when using this formulas i get the correct value for January Month - but not fo the other months represented in my Matrix....
So i need to adapt the code in a way so the SUMX fucntion always will take the value from >= "01-01-2024" with the state "Budget".... As i see it here it takes the values it finds within the monthly represented column
Then it need to set the MonthlyDistribution for each month represented in my Matrix....