Forum Discussion

KasperFB's avatar
KasperFB
Frequent Visitor
4 years ago
Solved

Calculations with table totals

I have these tables in PowerBI which shows the number of tasks created in a year, how long the average completiontime and when they are completed. The count and average is calculated in the visual. ...
  • v-jingzhang's avatar
    4 years ago

    Hi KasperFB 

     

    Does all data come from the same source table? Do all these 4 table visuals display on the report page at the same time? If so, which filter do you set on each table visual to filter the FY? 

     

    If you want to calculate the difference between two yearly totals, you need to use measures. Assume you have a column "FY" with values FY17, FY18, FY19... in the source table, you can use below measure to get the total of created in FY19.

     

    Created FY19 =
    CALCULATE (
        SUM ( 'Table'[Created Number] ),
        ALLEXCEPT ( 'Table', 'Table'[Worker], 'Table'[Department] ),
        'Table'[FY] = "FY19"
    )
    

     

    For the page filters you want to keep, you can add them to ALLEXCEPT function in above measure. You can create similar measures for other FYs. Then create the following measure to calculate the difference percentage. 

     

    Created % =
    DIVIDE ( [Created FY19] - [Created FY18], [Created FY18] )
    

     

     

    Or you can combine all of them into a measure

     

    Created % =
    VAR vFY19 =
        CALCULATE (
            SUM ( 'Table'[Created Number] ),
            ALLEXCEPT ( 'Table', 'Table'[Worker], 'Table'[Department] ),
            'Table'[FY] = "FY19"
        )
    VAR vFY18 =
        CALCULATE (
            SUM ( 'Table'[Created Number] ),
            ALLEXCEPT ( 'Table', 'Table'[Worker], 'Table'[Department] ),
            'Table'[FY] = "FY18"
        )
    RETURN
        DIVIDE ( vFY19 - vFY18, vFY18 )
    

     

    Similarly, you can calculate AVERAGE and COUNT instead of SUM with the same mode. 

     

    Best Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as Solution to help other members find it.