Forum Discussion

sur27078's avatar
sur27078
Regular Visitor
11 months ago
Solved

How to calculate % from single column

I'm currently working with a General Ledger (GL) dataset that includes only the following columns: Year, GL Account, Cost Center, Month, and Balance. I’ve created a visual card that filters data bas...
  • GeraldGEmerick's avatar
    11 months ago

    sur27078 You should be able to do something like the following:

    Gross Margin % =
    VAR _TotalRevenue = CALCULATE( SUM( 'Table'[Balance]), ALL( 'Table' ) )
    VAR _GrossProfit = CALCULATE( SUM( 'Table'[Balance] ), FILTER( ALL( 'Table' ), [GL_Account] IN { "5014", "4508" } ) )
    VAR _Return = DIVIDE( _GrossProfit, _TotalRevenue, 0 )
    RETURN _Return

    You would need to modify this for whatever your GL_Account codes are for however you are filtering your Revenue and Gross Profit card visuals.