Forum Discussion

KarlConstruct's avatar
KarlConstruct
Frequent Visitor
7 years ago
Solved

Calculating Average Time based on a Status

Hello,   I am struggling with a problem calculating average days in Power BI Desktop.   I have the following data in their own columns;   Status Column Created date (date/hh/mm/ss) Las...
  • jsh121988's avatar
    jsh121988
    7 years ago

    So in PowerBI there are 2 locations to create custom calculated columns:

    1. Through Query Editor using PowerQuery (M) language
    2. Though the main window using DAX language. This is similiar to excel.

    I gave you the DAX version because it's easier to read/understand/manipulate IMO. With DAX, you don't need to reload your data everytime there is logic changed on a caluclated column. Instead, DAX uses your existing loaded dataset, and processes the logic. This makes is much more agile than SQL or PowerQuery. However, I still write native SQL queries to pull my data, and even build calculated columns in SQL. I tend to avoid PowerQuery if possible, though it has it's benefits like parsing JSON.

     

    Going Forward:

    1. Delete that step in PowerQuery
    2. Load your data
    3. From the Home Tab, Add a Calculated Column
    4. Paste my formula
    5. View the data on the Data view on the left side of the main Pbi window

    Add Field