Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Calculating Percentage Between Two Date Columns

I wish to calculate the percentage between two date columns.   I created a New Column and used the following:   PROD % = DIVIDE('Production Data'[ON SCHEDULE]|('Production Data'[Started])   The e...
  • TomMartens's avatar
    TomMartens
    8 years ago

    Hey,

     

    1. your formula works, on a single row level. This is how calculated columns work. Evaluate the formula row by row.This formula will be executed each time the table will be refreshed.

     

    This will now lead to the "wrong" behavior if thsi column is used in any visual that provides "Total" rows or column, meaning the application of an aggregation function , by default "SUM" whenver more than one row has to be used to create a result.

     

    For this reason I was mentioning to change the default summerization of the calculated column, eg from SUM to AVERAGE. This is the only possibility if you want to stick with calculated columns.

     

    If you move to a measure, you can do the following:

    1.  Create a measure for your first date coulumn
    2. Create a measure for your 2nd date coulumn
    3. Create a measure that uses both measures in your formula

    Measures are in a way "overruling" the application of aggregation functions.

     

    If you encouter difficulties to create measures please consider to create a pbix file that contains sample data, upload the file to onedrive or dropbox and share the link. If you a Excel file as data source for the pbix file, alos upload the Excel file.

     

    Regards,

    Tom