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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
KimStahl94
Helper I
Helper I

YE and YTD p&l calculation

Hi there,

 

I am trying to display a customized p&l statement as below (shortened extract). The position "Rohertrag" is a sum of "Gesamtleistung and KER". "Wertschöpfung" ist a sum of "Rohertrag" and "Sonst. betriebl. Erlöse". The displayed numbers are correct, but in my YTD measure the subtotals aren't displayed.

 

 BWA ZwischenergebnisCasePL YEPL YTD
 Gesamtleistung134.941.596 €11.353.157 €
+ KER1-3.114.444 €-812.144 €
=Rohertrag1031.827.152 € 
+Sonstige betriebl. Erlöse138.732 €12.066 €
=Wertschöpfung1131.865.885 € 

 

Right now I am using a rather complex (or naive) measure, which, firstly, distinguishes different hierarchy combinations in my p&l statement. The case 1 totals are simply calculated via a column filter, but the totals for the >=10 cases can not be measured via a unique column filter (This is because I want to avoid using a m:n relation between my DIM and FACT Table by mapping my revenue accounts to multiple sub and grand totals).

 

 

 

PL YE = 
SWITCH ( [Case] ,
    10 , CALCULATE ( SUM ( 'FAKT Planwerte'[Planwert] ) , FILTER ( ALL ( 'DIM BWA' ), 'DIM BWA'[BWA Zwischenergebnis] IN { "Gesamtleistung" , "KER" } ) ) ,
    11 , CALCULATE ( SUM ( 'FAKT Planwerte'[Planwert] ) , FILTER ( ALL ( 'DIM BWA' ), 'DIM BWA'[BWA Zwischenergebnis] IN { "Gesamtleistung" , "KER" , "Sonstige betriebl. Erlöse" } ) ) ,
SUM ( 'FAKT Planwerte'[Planwert] ) )

 

 

If I then use this YE measures, which works fine, in another YTD Measure, with the latest Month from my Actual data as date filter in the following way, it does not show my grandtotals.

 

 

PL YTD = 
CALCULATE 
    ( 
        [PL YE] , 
        FILTER 
            (
                'DIM Datum' ,
                MONTH ( 'DIM Datum'[Datum] ) <= MONTH  ( MAX ('FAKT Istwerte'[Monat] ) )  
            )
    )

 

 

I guess my overall approach could be a bit more professional (maybe a calculatedtable, but I have no experience with them), but right now I would be content with the YTD measure delivering correct results based on my YE measure. Any ideas on how to solve this issue?

 

Regards
KS

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@KimStahl94 , for YTD you can use try one of the two can use datesytd

 

PL YTD =
CALCULATE
(
[PL YE] ,
FILTER
(
'DIM Datum' ,
MONTH ( 'DIM Datum'[Datum] ) <= MONTH ( MAX ('FAKT Istwerte'[Monat] ) )
year ( 'DIM Datum'[Datum] ) <= year ( MAX ('FAKT Istwerte'[Monat] ) )
)
)
or


PL YTD =
CALCULATE
(
[PL YE] ,
FILTER
(
'DIM Datum' ,
MONTH ( 'DIM Datum'[Datum] ) <= MONTH ( MAX ( 'DIM Datum'[Datum] ) )
year ( 'DIM Datum'[Datum] ) <= year ( MAX ( 'DIM Datum'[Datum] ) )
)
)

 

 

example

 

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),previousyear('Date'[Date],1,Year), "7/31")

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

2 REPLIES 2
KimStahl94
Helper I
Helper I

Thanks @amitchandak !

I tested it in my previous model and it worked fine.

Regards

KS

amitchandak
Super User
Super User

@KimStahl94 , for YTD you can use try one of the two can use datesytd

 

PL YTD =
CALCULATE
(
[PL YE] ,
FILTER
(
'DIM Datum' ,
MONTH ( 'DIM Datum'[Datum] ) <= MONTH ( MAX ('FAKT Istwerte'[Monat] ) )
year ( 'DIM Datum'[Datum] ) <= year ( MAX ('FAKT Istwerte'[Monat] ) )
)
)
or


PL YTD =
CALCULATE
(
[PL YE] ,
FILTER
(
'DIM Datum' ,
MONTH ( 'DIM Datum'[Datum] ) <= MONTH ( MAX ( 'DIM Datum'[Datum] ) )
year ( 'DIM Datum'[Datum] ) <= year ( MAX ( 'DIM Datum'[Datum] ) )
)
)

 

 

example

 

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),previousyear('Date'[Date],1,Year), "7/31")

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.