Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
grkanth81
Helper I
Helper I

Help with creating a new measure or column

Hi,

Can you please provide your suggestions to create a new measure or column  in the below scenario ?

I have created a dummy data set which has some columns and values. I would like to create a new measure or new column with the below formula :

(SUM of Hours worked / SUM of FTE / No of months ) * 12

So I would like the result to be shown as grouped by period as below:

Period     New Measure value
202401    71.61

Here is the breakdown for 202401 based on the above formula:
Sum of hours worked = 18.5
Sum of FTE = 3.1
No of months = 1

So it should be - (18.5/3.1/1)*12 = 71.61

 

PeriodNo of MonthsEmployeeCodeFTEHoursWorked
20240111000.61.1
20240221000.62.1
20240331000.60.7
20240441000.62.4
20240551000.60.9
202401112818.7
20240221280.755.2
20240331280.83.8
20240441280.82.9
202405512817.1
202401122218.7
202402222215.2
202403322213.8
202404422212.9
202405522217.1
20240115470.50
20240225470.50
20240335470.50
20240445470.50
20240555470.50
     
     

 

 

I have created a measure for sum of hours worked / sum of FTE. But I am a bit struck as to how to include No of months in that measure.

Thanks,

Rav

2 ACCEPTED SOLUTIONS
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file whether it suits your requirement.

 

Jihwan_Kim_1-1702267954692.png

 

 

Jihwan_Kim_0-1702267910871.png

 

 

Expected result measure: =
VAR _workhours =
    SUM ( Data[HoursWorked] )
VAR _fte =
    SUM ( Data[FTE] )
VAR _noofmonth =
    SELECTEDVALUE ( Period[No of Months] )
VAR _result =
    DIVIDE ( DIVIDE ( _workhours, _fte ), _noofmonth ) * 12
RETURN
    _result

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

Hi, 

Thank you for your message, and please check the below picture and the attached pbix file whether it suits your requirement.

Jihwan_Kim_0-1702305176820.png

 

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

5 REPLIES 5
soniya-01
New Member

Creating a new measure or column in a data table involves adding a calculation or combining existing data to get a new piece of information. Here's a simple guide:

For Measures (usually numeric calculations):

  1. Identify What You Need:

    • Determine what kind of calculation or analysis you want to perform. For example, you might want to calculate the total sales, average price, or growth rate.
  2. Use Formulas:

    • Look for a "Formula" or "Calculation" option, depending on the tool or software you're using.
    • Write a formula using basic math operations like addition, subtraction, multiplication, and division. For example, to calculate total sales, you might add up the values in the "Sales" column.
  3. Apply and Save:

    • Apply the formula to create your new measure.
    • Save or update the data table to make the new measure a permanent part of your dataset.

For Columns (usually text or categorical data):

  1. Define the New Column:

    • Decide what information you want in your new column. This could be a combination of existing columns, a conditional statement, or any other relevant data.
  2. Create the Column:

    • Find an option like "Add Column" or "Create New Field" in your tool.
    • Specify the logic or conditions for the new column. For instance, if you want a column indicating whether sales are above a certain threshold, you might create a column with values like "High" or "Low."
  3. Confirm and Save:

    • Confirm your choices and save the changes to the data table.

Example:

Let's say you have a "Quantity" and "Price" column, and you want to create a new column called "Total Sales."

  • For Measures:

    • Formula: Total Sales = Quantity * Price
    • Apply: Multiply the values in the "Quantity" and "Price" columns for each row.
  • For Columns:

    • New Column Logic: If Total Sales > 1000, then "High," else "Low."
    • Create Column: Add a new column with these conditions.
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file whether it suits your requirement.

 

Jihwan_Kim_1-1702267954692.png

 

 

Jihwan_Kim_0-1702267910871.png

 

 

Expected result measure: =
VAR _workhours =
    SUM ( Data[HoursWorked] )
VAR _fte =
    SUM ( Data[FTE] )
VAR _noofmonth =
    SELECTEDVALUE ( Period[No of Months] )
VAR _result =
    DIVIDE ( DIVIDE ( _workhours, _fte ), _noofmonth ) * 12
RETURN
    _result

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Thank you Jihwan. That worked. I also need to get the average of that measure. I know how to get the average if the value is numeric but how to get the average of the created measure in this case ?

Thanks,

Rav

Hi, 

Thank you for your message, and please check the below picture and the attached pbix file whether it suits your requirement.

Jihwan_Kim_0-1702305176820.png

 

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Thank you Jihwan. That worked.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.