Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.
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))
)
Solved! Go to Solution.
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))
)
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))
)
Check out the November 2023 Power BI update to learn about new features.
Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.