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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Data model pratice - extract and transform tables - SAP ERP

Hi,

 

I want to create a dashbord of the absence of my company and I'm preparing the data model to begin the calculations, but I have some issues that I can't understand why to solve it.

 

I extract a transaction table of the absence that have the following headers: employee nº, absence type, start date, end date, nº days, nº hours (I have the same employee number in several rows that evidence diferents types of absence over time).

 

I want to do the calculations based on employee category, HR area, etc., but the same employee can have several categories and HR area over time, and the data that I extract is in the following way:

 

Employee nºCategoryStart dateEnd date
1Administrative01/01/202030/06/2020
1Manager01/07/202031/08/2020
1 toDirector01/09/2020 

 

Employee nºHR areaStart dateEnd date
1Area101/01/202030/06/2020
1Area201/07/202031/08/2020
1Area101/09/2020 

 

My goal is that the employee 1 counts for the absence of "Administrative" and "Area1" and in august in "Manager" and "Area2".

 

  1. How can I manage the model and relationships between this tables?
  2. The tables above are both transactions tables?

 

Regards,

 

Carlos

5 REPLIES 5
Anonymous
Not applicable

@v-yangliu-msft 

@amitchandak @Ashish_Mathur 

Thank You for your help!

 

My problem is how to design the data model.

 

There are some pictures of my data model and tables:

 

Carlos_Ruxa_BI_0-1609409541627.png

 

fContractType:

Carlos_Ruxa_BI_3-1609409838963.png

 

fProfessionalGrp:

Carlos_Ruxa_BI_4-1609409936900.png

 

In this tables, it is possible to have Employee ID repeated because they can change their professional category and contract type over the time.

 

The table fEmployeeData have only one row with each EmployeeID.

 

I'm a beginner in PowerBI, and I have planned do trainning in March, but I want to develop some knowledge until there.

 

Thanks for yours support.

 

 

Hi,

Did my calculated formula work?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous ,

Here are the steps you can follow:

1. Create calculated table.

Table = SUMMARIZE('Table1','Table1'[Employee nº],'Table1'[Category],'Table1'[Start date],'Table1'[End date],
"HR area",CALCULATE(MAX('Table2'[HR area]),FILTER('Table2','Table2'[Employee nº]=EARLIER('Table1'[Employee nº])&&'Table2'[Start date]=EARLIER('Table1'[Start date])&&'Table2'[End date]=EARLIER('Table1'[End date]))))

2. Result.

v-yangliu-msft_0-1609319456922.jpeg

You can downloaded PBIX file from here.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User
Ashish_Mathur
Super User
Super User

Hi,

If the Start date and End Date columns in both datasets match for the same employee, then write this calculated column formula in Table1

=lookupvalue(Table2[HR Area],Table2[Employee Number],Table1[Employee Number],Table2[Start date],Table1[Start date],Table2[End date],Table1[End date])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.