Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
vanweelden
Frequent Visitor

Cumulativ Last Year

Hi,

I'm struggling with two measures. I have a Balance report that is build up with data from multiple years.

Now i have a measure that calculate the right values on a particular Date.

Now i want a measure that calculates the values from last year till that particular date (-1 year) and i want to calculate the values till the end of last year.

So if i select Year 2023 Month 4, i become the cumulative values:

Measure 1 cumulative Year 2023 Month 4  (working)

Measure 2 cumulative Year 2022 Month 4  (not working)

Measure 3 cumulative Year 2022 Month 12 (not working)

 

How can i achieve this? Thank you!

 

Measure 1:

Ist Year Bilanz **bleep**:=VAR Current_Item= IF(HASONEVALUE('Template Bilanz'[Bilanz]);VALUES('Template Bilanz'[Bilanz]))
RETURN
SWITCH(
TRUE();
Current_Item = "Immaterielle Vermögensgegenstände"; VAR MaxDate = Max (Datumtabel[Date]) return Calculate([Immaterielle Vermögensgegenstände];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));
Current_Item= "Sachanlagen"; VAR MaxDate = Max (Datumtabel[Date]) return Calculate([Sachanlagen];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));
Current_Item = "Finanzanlagen"; VAR MaxDate = Max (Datumtabel[Date]) return Calculate([Finanzanlagen];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));
Current_Item= "Anlagevermögen"; VAR MaxDate = Max (Datumtabel[Date]) return Calculate([Anlagevermögen];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));
Current_Item = "Umlaufvermögen"; VAR MaxDate = Max (Datumtabel[Date]) return Calculate([Umlaufvermögen];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));
Current_Item= "Aktiva"; VAR MaxDate = Max (Datumtabel[Date]) return Calculate([Aktiva];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));
Current_Item = "Jahresüberschuss1"; VAR MaxDate = Max (Datumtabel[Date]) return Calculate([Jahresüberschuss2];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));
Current_Item= "Verbindlichkeiten"; VAR MaxDate = Max (Datumtabel[Date]) return Calculate([Verbindlichkeiten];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));
Current_Item = "Passiva"; VAR MaxDate = Max (Datumtabel[Date]) return Calculate([Passiva];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));
VAR MaxDate = MAX(Datumtabel[Date])
Return
CALCULATE(
CALCULATE(
[Ist bedrag];
FILTER('Ertragslage Ist';
'Ertragslage Ist'[Ertragslage] = Current_Item))
;Datumtabel[Date]<= MaxDate;ALL(Datumtabel))
)

1 ACCEPTED SOLUTION
vanweelden
Frequent Visitor

I found the other Measures:

 

Measure 2:

Ist LY Bilanz **bleep**:=VAR Current_Item= IF(HASONEVALUE('Template Bilanz'[Bilanz]);VALUES('Template Bilanz'[Bilanz]))

RETURN

SWITCH(

TRUE();

Current_Item = "Immaterielle Vermögensgegenstände"; VAR MaxDate = Max (Datumtabel[Date])-365 return Calculate([Immaterielle Vermögensgegenstände];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

Current_Item= "Sachanlagen"; VAR MaxDate = Max (Datumtabel[Date])-365 return Calculate([Sachanlagen];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

Current_Item = "Finanzanlagen"; VAR MaxDate = Max (Datumtabel[Date])-365 return Calculate([Finanzanlagen];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

Current_Item= "Anlagevermögen"; VAR MaxDate = Max (Datumtabel[Date])-365 return Calculate([Anlagevermögen];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

Current_Item = "Umlaufvermögen"; VAR MaxDate = Max (Datumtabel[Date])-365 return Calculate([Umlaufvermögen];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

Current_Item= "Aktiva"; VAR MaxDate = Max (Datumtabel[Date])-365 return Calculate([Aktiva];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

Current_Item = "Jahresüberschuss1"; VAR MaxDate = Max (Datumtabel[Date])-365 return Calculate([Jahresüberschuss2];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

Current_Item= "Verbindlichkeiten"; VAR MaxDate = Max (Datumtabel[Date])-365 return Calculate([Verbindlichkeiten];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

Current_Item = "Passiva"; VAR MaxDate = Max (Datumtabel[Date])-365 return Calculate([Passiva];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

VAR MaxDate = MAX(Datumtabel[Date])-365

Return

CALCULATE(

CALCULATE(

-[Ist bedrag];

FILTER('Ertragslage Ist';

'Ertragslage Ist'[Ertragslage] = Current_Item))

;Datumtabel[Date]<= MaxDate;ALL(Datumtabel))

)

 

Measure 3:

Ist Vorjahr Bilanz **bleep**:=VAR Current_Item= IF(HASONEVALUE('Template Bilanz'[Bilanz]);VALUES('Template Bilanz'[Bilanz]))

RETURN

SWITCH(

TRUE();

Current_Item = "Immaterielle Vermögensgegenstände"; VAR MaxDate = ENDOFYEAR(DATEADD (Datumtabel[Date];-1;YEAR)) return Calculate([Immaterielle Vermögensgegenstände];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

Current_Item= "Sachanlagen"; VAR MaxDate = ENDOFYEAR(DATEADD (Datumtabel[Date];-1;YEAR)) return Calculate([Sachanlagen];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

Current_Item = "Finanzanlagen"; VAR MaxDate = ENDOFYEAR(DATEADD (Datumtabel[Date];-1;YEAR)) return Calculate([Finanzanlagen];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

Current_Item= "Anlagevermögen"; VAR MaxDate = ENDOFYEAR(DATEADD (Datumtabel[Date];-1;YEAR)) return Calculate([Anlagevermögen];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

Current_Item = "Umlaufvermögen"; VAR MaxDate = ENDOFYEAR(DATEADD (Datumtabel[Date];-1;YEAR)) return Calculate([Umlaufvermögen];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

Current_Item= "Aktiva"; VAR MaxDate = ENDOFYEAR(DATEADD (Datumtabel[Date];-1;YEAR)) return Calculate([Aktiva];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

Current_Item = "Jahresüberschuss1"; VAR MaxDate = ENDOFYEAR(DATEADD (Datumtabel[Date];-1;YEAR)) return Calculate([Jahresüberschuss2];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

Current_Item= "Verbindlichkeiten"; VAR MaxDate = ENDOFYEAR(DATEADD (Datumtabel[Date];-1;YEAR)) return Calculate([Verbindlichkeiten];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

Current_Item = "Passiva"; VAR MaxDate = ENDOFYEAR(DATEADD (Datumtabel[Date];-1;YEAR)) return Calculate([Passiva];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

VAR MaxDate = ENDOFYEAR(DATEADD (Datumtabel[Date];-1;YEAR))

Return

CALCULATE(

CALCULATE(

-[Ist bedrag];

FILTER('Ertragslage Ist';

'Ertragslage Ist'[Ertragslage] = Current_Item))

;Datumtabel[Date]<= MaxDate;ALL(Datumtabel))

)

View solution in original post

1 REPLY 1
vanweelden
Frequent Visitor

I found the other Measures:

 

Measure 2:

Ist LY Bilanz **bleep**:=VAR Current_Item= IF(HASONEVALUE('Template Bilanz'[Bilanz]);VALUES('Template Bilanz'[Bilanz]))

RETURN

SWITCH(

TRUE();

Current_Item = "Immaterielle Vermögensgegenstände"; VAR MaxDate = Max (Datumtabel[Date])-365 return Calculate([Immaterielle Vermögensgegenstände];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

Current_Item= "Sachanlagen"; VAR MaxDate = Max (Datumtabel[Date])-365 return Calculate([Sachanlagen];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

Current_Item = "Finanzanlagen"; VAR MaxDate = Max (Datumtabel[Date])-365 return Calculate([Finanzanlagen];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

Current_Item= "Anlagevermögen"; VAR MaxDate = Max (Datumtabel[Date])-365 return Calculate([Anlagevermögen];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

Current_Item = "Umlaufvermögen"; VAR MaxDate = Max (Datumtabel[Date])-365 return Calculate([Umlaufvermögen];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

Current_Item= "Aktiva"; VAR MaxDate = Max (Datumtabel[Date])-365 return Calculate([Aktiva];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

Current_Item = "Jahresüberschuss1"; VAR MaxDate = Max (Datumtabel[Date])-365 return Calculate([Jahresüberschuss2];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

Current_Item= "Verbindlichkeiten"; VAR MaxDate = Max (Datumtabel[Date])-365 return Calculate([Verbindlichkeiten];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

Current_Item = "Passiva"; VAR MaxDate = Max (Datumtabel[Date])-365 return Calculate([Passiva];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

VAR MaxDate = MAX(Datumtabel[Date])-365

Return

CALCULATE(

CALCULATE(

-[Ist bedrag];

FILTER('Ertragslage Ist';

'Ertragslage Ist'[Ertragslage] = Current_Item))

;Datumtabel[Date]<= MaxDate;ALL(Datumtabel))

)

 

Measure 3:

Ist Vorjahr Bilanz **bleep**:=VAR Current_Item= IF(HASONEVALUE('Template Bilanz'[Bilanz]);VALUES('Template Bilanz'[Bilanz]))

RETURN

SWITCH(

TRUE();

Current_Item = "Immaterielle Vermögensgegenstände"; VAR MaxDate = ENDOFYEAR(DATEADD (Datumtabel[Date];-1;YEAR)) return Calculate([Immaterielle Vermögensgegenstände];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

Current_Item= "Sachanlagen"; VAR MaxDate = ENDOFYEAR(DATEADD (Datumtabel[Date];-1;YEAR)) return Calculate([Sachanlagen];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

Current_Item = "Finanzanlagen"; VAR MaxDate = ENDOFYEAR(DATEADD (Datumtabel[Date];-1;YEAR)) return Calculate([Finanzanlagen];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

Current_Item= "Anlagevermögen"; VAR MaxDate = ENDOFYEAR(DATEADD (Datumtabel[Date];-1;YEAR)) return Calculate([Anlagevermögen];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

Current_Item = "Umlaufvermögen"; VAR MaxDate = ENDOFYEAR(DATEADD (Datumtabel[Date];-1;YEAR)) return Calculate([Umlaufvermögen];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

Current_Item= "Aktiva"; VAR MaxDate = ENDOFYEAR(DATEADD (Datumtabel[Date];-1;YEAR)) return Calculate([Aktiva];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

Current_Item = "Jahresüberschuss1"; VAR MaxDate = ENDOFYEAR(DATEADD (Datumtabel[Date];-1;YEAR)) return Calculate([Jahresüberschuss2];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

Current_Item= "Verbindlichkeiten"; VAR MaxDate = ENDOFYEAR(DATEADD (Datumtabel[Date];-1;YEAR)) return Calculate([Verbindlichkeiten];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

Current_Item = "Passiva"; VAR MaxDate = ENDOFYEAR(DATEADD (Datumtabel[Date];-1;YEAR)) return Calculate([Passiva];Datumtabel[Date] <= MaxDate;ALL(Datumtabel));

VAR MaxDate = ENDOFYEAR(DATEADD (Datumtabel[Date];-1;YEAR))

Return

CALCULATE(

CALCULATE(

-[Ist bedrag];

FILTER('Ertragslage Ist';

'Ertragslage Ist'[Ertragslage] = Current_Item))

;Datumtabel[Date]<= MaxDate;ALL(Datumtabel))

)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.