Forum Discussion

eric_avril's avatar
eric_avril
New Member
2 years ago

looking for some help on powerquery /DAX

Hello, i'm new to power query/dex. I looking to solve :

I have 3 tables :

table 1 : Engineers, with 1 col : engineer name

table 2 : project with 2 cols : projet name and numbrer of budget days sold to customer for the project

table 3 :  activities registry  with 3 cols : project name, engineer name and the amount of time he's donne on the activity (it's the project timesheet).

i've created the 3 tables and imported them in the excel datamodel - ok.

i need to produce a report (excel pivot table is ok) with :

rep1 - Total  days of activities par project, per engineer (easily done with a pivot table)

rep 2 - Total days of activities compared to budget allowed per project

rep 3 - Same of above, but detailed per engineer.

I'm ok with rep 1, but unable to produce rep2 and 3, as i don't know how to use the DAX code actually (if it iis needed..)

Your help is very, very welcomed !

 

 

Eric

2 Replies

  • To help you with your reports in Power BI, you'll need to create a few DAX measures to compare the total days of activities to the budget allowed, and then break it down by engineer. Here's a step-by-step guide for each of the reports you want to generate:

    1. Total Days of Activities Compared to Budget Allowed Per Project

    For this report, you need to calculate the total days of activities and compare it to the budget days.

    Steps:

    1. Create a Measure for Total Days of Activities:

      • Open Power BI Desktop.
      • Go to the Modeling tab and click on New Measure.
      • Enter the following DAX formula:
        TotalActivityDays = SUM('activities registry'[amount of time])
    2. Create a Measure for Budget Days:

      • Go to the Modeling tab and click on New Measure.
      • Enter the following DAX formula:
        BudgetDays = SUM('project'[number of budget days sold to customer])
    3. Create a Measure for Comparison:

      • Go to the Modeling tab and click on New Measure.
      • Enter the following DAX formula:
        ActivityVsBudget = [TotalActivityDays] - [BudgetDays]
    4. Create a Pivot Table:

      • Add a new visual to your report, such as a table or matrix.
      • Place project name from the project table in the rows.
      • Add the TotalActivityDays, BudgetDays, and ActivityVsBudget measures to the values.

    2. Total Days of Activities Compared to Budget Allowed Per Project Detailed by Engineer

    For this report, you need to break down the comparison by engineer.

    Steps:

    1. Create a Measure for Total Days of Activities by Engineer:

      • Go to the Modeling tab and click on New Measure.
      • Enter the following DAX formula:
        TotalActivityDaysByEngineer = SUM('activities registry'[amount of time])
    2. Create a Measure for Budget Days by Project:

      • This is the same measure as before, BudgetDays.
    3. Create a Measure for Activity vs Budget by Engineer:

      • Go to the Modeling tab and click on New Measure.
      • Enter the following DAX formula:
        ActivityVsBudgetByEngineer = [TotalActivityDaysByEngineer] - [BudgetDays]
    4. Create a Pivot Table:

      • Add a new visual to your report.
      • Place project name and engineer name from the activities registry table in the rows.
      • Add the TotalActivityDaysByEngineer, BudgetDays, and ActivityVsBudgetByEngineer measures to the values.

    Summary

    • Rep 1: Total days of activities per project and engineer (already done).
    • Rep 2: Total days of activities compared to budget allowed per project.
      • Measures needed: TotalActivityDays, BudgetDays, and ActivityVsBudget.
    • Rep 3: Total days of activities compared to budget allowed per project detailed by engineer.
      • Measures needed: TotalActivityDaysByEngineer, BudgetDays, and ActivityVsBudgetByEngineer.

    These DAX measures and steps should help you generate the reports you need in Power BI. If you have any questions or run into issues, feel free to ask!

    • eric_avril's avatar
      eric_avril
      New Member

      Hello Shravan,

      Wow ! i did not expect such a quick and detailed feedback !

      I'll read, try to understand  and implement it soon this week (i'm a bit overbooked actually for other purposes...) Best regards, i'll keep you informed .. Eric