You can use Switch True to define those groupings you do not want to expand. Here is a sample of the dax code:
SWITCH(
TRUE()
// use this example to eliminate account rows expansion in matrix. You have to define every possible scope separately.
//Operating Profit (Loss)
, ISINSCOPE('Profit and Loss report'[Account Group]) && ISINSCOPE('Profit and Loss report'[Account SubGroup]) && ISINSCOPE('Profit and Loss report'[Account Name]) && ISINSCOPE('Chart Of Accounts'[Kood Konto (eng)]) && SELECTEDVALUE('Profit and Loss report'[Account Group]) = "Operating Profit (Loss)", BLANK()
, ISINSCOPE('Profit and Loss report'[Account Group]) && ISINSCOPE('Profit and Loss report'[Account SubGroup]) && ISINSCOPE('Profit and Loss report'[Account Name]) && SELECTEDVALUE('Profit and Loss report'[Account Group]) = "Operating Profit (Loss)", BLANK()
, ISINSCOPE('Profit and Loss report'[Account Group]) && ISINSCOPE('Profit and Loss report'[Account SubGroup]) && SELECTEDVALUE('Profit and Loss report'[Account Group]) = "Operating Profit (Loss)", BLANK()
//Profit (loss) before tax
, ISINSCOPE('Profit and Loss report'[Account Group]) && ISINSCOPE('Profit and Loss report'[Account SubGroup]) && ISINSCOPE('Profit and Loss report'[Account Name]) && ISINSCOPE('Chart Of Accounts'[Kood Konto (eng)]) && SELECTEDVALUE('Profit and Loss report'[Account Group]) = "Profit (loss) before tax", BLANK()
, ISINSCOPE('Profit and Loss report'[Account Group]) && ISINSCOPE('Profit and Loss report'[Account SubGroup]) && ISINSCOPE('Profit and Loss report'[Account Name]) && SELECTEDVALUE('Profit and Loss report'[Account Group]) = "Profit (loss) before tax", BLANK()
, ISINSCOPE('Profit and Loss report'[Account Group]) && ISINSCOPE('Profit and Loss report'[Account SubGroup]) && SELECTEDVALUE('Profit and Loss report'[Account Group]) = "Profit (loss) before tax", BLANK()
//Annual period profit (loss)
, ISINSCOPE('Profit and Loss report'[Account Group]) && ISINSCOPE('Profit and Loss report'[Account SubGroup]) && ISINSCOPE('Profit and Loss report'[Account Name]) && ISINSCOPE('Chart Of Accounts'[Kood Konto (eng)]) && SELECTEDVALUE('Profit and Loss report'[Account Group]) = "Annual period profit (loss)", BLANK()
, ISINSCOPE('Profit and Loss report'[Account Group]) && ISINSCOPE('Profit and Loss report'[Account SubGroup]) && ISINSCOPE('Profit and Loss report'[Account Name]) && SELECTEDVALUE('Profit and Loss report'[Account Group]) = "Annual period profit (loss)", BLANK()
, ISINSCOPE('Profit and Loss report'[Account Group]) && ISINSCOPE('Profit and Loss report'[Account SubGroup]) && SELECTEDVALUE('Profit and Loss report'[Account Group]) = "Annual period profit (loss)", BLANK()
//===============================================================================================================
// here are sub calculations and matrix total calculation
, SELECTEDVALUE('Profit and Loss report'[Account Group]) = "Operating profit (loss)",
CALCULATE( SUM( 'PL Data'[Amount eur] ) , FILTER( ALL( 'Profit and Loss report' ), 'Profit and Loss report'[Account Group] = "Revenue" ) ) + CALCULATE( SUM( 'PL Data'[Amount eur] ) , FILTER( ALL( 'Profit and Loss report' ), 'Profit and Loss report'[Account Group] = "Operating and administrative costs" ) )
, SELECTEDVALUE('Profit and Loss report'[Account Group]) = "Profit (loss) before tax",
CALCULATE( SUM( 'PL Data'[Amount eur] ) , FILTER( ALL( 'Profit and Loss report' ), 'Profit and Loss report'[Account Group] = "Revenue" ) ) + CALCULATE( SUM( 'PL Data'[Amount eur] ) , FILTER( ALL( 'Profit and Loss report' ), 'Profit and Loss report'[Account Group] = "Operating and administrative costs" )) + CALCULATE( SUM( 'PL Data'[Amount eur] ) , FILTER( ALL( 'Profit and Loss report' ), 'Profit and Loss report'[Account Group] = "Adjustments" )) + CALCULATE( SUM( 'PL Data'[Amount eur] ) , FILTER( ALL( 'Profit and Loss report' ), 'Profit and Loss report'[Account Group] = "Financial and other" ) )
, SELECTEDVALUE('Profit and Loss report'[Account Group]) = "Annual period profit (loss)",
CALCULATE( SUM( 'PL Data'[Amount eur] ) , FILTER( ALL( 'Profit and Loss report' ), 'Profit and Loss report'[Account Group] = "Revenue" ) ) + CALCULATE( SUM( 'PL Data'[Amount eur] ) , FILTER( ALL( 'Profit and Loss report' ), 'Profit and Loss report'[Account Group] = "Operating and administrative costs" )) + CALCULATE( SUM( 'PL Data'[Amount eur] ) , FILTER( ALL( 'Profit and Loss report' ), 'Profit and Loss report'[Account Group] = "Adjustments" )) + CALCULATE( SUM( 'PL Data'[Amount eur] ) , FILTER( ALL( 'Profit and Loss report' ), 'Profit and Loss report'[Account Group] = "Financial and other" )) + CALCULATE( SUM( 'PL Data'[Amount eur] ) , FILTER( ALL( 'Profit and Loss report' ), 'Profit and Loss report'[Account Group] = "Tax" ) )
, ISINSCOPE('Profit and Loss report'[Account Group]), SUM('PL Data'[Amount eur])
, CALCULATE( SUM('PL Data'[Amount eur]), PL_Account_Report_Structure[Account Group] <> "All accounts" ) - CALCULATE( SUM('PL Data'[Amount eur]), PL_Account_Report_Structure[Account Group] = "All accounts" )
)