Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Return max row count

Hi All,    I have a table like the following:    Month Cost Centre Pay Period Number  1/7/21 XX1 1 1/7/21 XX1 2 1/7/21 XX1 3 1/8/21  XX1 4 1/8/21  XX1 5 1/...
  • Jihwan_Kim's avatar
    Jihwan_Kim
    4 years ago

     

    expected result: =
    VAR amounttotal =
    CALCULATE (
    SUM ( 'Table'[Amount] ),
    ALLEXCEPT ( 'Table', 'Table'[Month], 'Table'[Cost Centre] )
    )
    VAR maxperiodnumber =
    CALCULATE (
    COUNTROWS('Table'),
    ALLEXCEPT ( 'Table', 'Table'[Month], 'Table'[Cost Centre] )
    )
    RETURN
    IF ( HASONEVALUE ( 'Table'[Month] ), DIVIDE ( amounttotal, maxperiodnumber ) )