cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Frequent Visitor

## Add columns to "pivot table"

Hi,

I'm trying to add calculated columns to 2 merged tables with Power Query to simulate a pivot table. The custom columns are:

Disponibilité: [Nombre employés]*7.5
Taux disponibilité: (1-[Indisponibilté]/[Disponibilté])*100

The only way I could do this in Excel was to add formulas alongside the pivot table.

Is there any solution to do this in Power Bi?

Here's the Excel file:

https://ufile.io/5oped

2 ACCEPTED SOLUTIONS
Community Support

HI, @misen08

After my test, you could do these follow my steps as below:

Step1:

If you column Code absence and column Date?

IF not, then remove one of them and then select column Catégorie click Transform->Pivot table

Values Column: The remaining one column( Code absence or Date), Aggregate Value Function : Count(All)

Click "OK"

Step2:

Cloes&Apply

Step3:

Create a relationship between T_Catégories with T_Métiers

Step4:

Create calculate measure:

Disponibilité: [Nombre employés]*7.5
Taux disponibilité: (1-[Indisponibilté]/[Disponibilté])*100

```Indisponibilite = CALCULATE(SUM([Congé]))+CALCULATE(SUM([Réunion]))+CALCULATE(SUM([Maladie]))

Disponibilité = Disponibilité = CALCULATE(SUM('T_Métiers'[Nombre])*7.5)

Taux disponibilité = AVERAGEX(SUMMARIZE('T_Catégories','T_Catégories'[Métier]), (1-[Indisponibilite]/[Disponibilité])*100)```

Result:

By the way, Let me explain why we don't use merge function and create column instead of Create the relationship and calculate measure? If use merge function and create column, we couldn't filter by month, for it will lead to duplicate value. Unless you do not filter result, you could use merge function and create column.

here is my pbix, please try it.

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Frequent Visitor

Hi,

I'm trying to add custom columns to a table made from 2 merged table of data with Power Query to simulate a pivot table.

Calculated columns:

Disponibilité: [Nombre employés]*7.5
Taux disponibilité: (1-[Indisponibilté]/[Disponibilté])*100

I can't seem to find any work around in Power Bi to do this.

In Excel, the only way I found was to add formulas alongside the pivot table.

Is there any solution to this in Power Bi?

Here's the Excel file with an example of what I'm trying to achieve:

https://ufile.io/5oped

Thanks.

3 REPLIES 3
Frequent Visitor

Hi,

I'm trying to add custom columns to a table made from 2 merged table of data with Power Query to simulate a pivot table.

Calculated columns:

Disponibilité: [Nombre employés]*7.5
Taux disponibilité: (1-[Indisponibilté]/[Disponibilté])*100

I can't seem to find any work around in Power Bi to do this.

In Excel, the only way I found was to add formulas alongside the pivot table.

Is there any solution to this in Power Bi?

Here's the Excel file with an example of what I'm trying to achieve:

https://ufile.io/5oped

Thanks.

Community Support

HI, @misen08

After my test, you could do these follow my steps as below:

Step1:

If you column Code absence and column Date?

IF not, then remove one of them and then select column Catégorie click Transform->Pivot table

Values Column: The remaining one column( Code absence or Date), Aggregate Value Function : Count(All)

Click "OK"

Step2:

Cloes&Apply

Step3:

Create a relationship between T_Catégories with T_Métiers

Step4:

Create calculate measure:

Disponibilité: [Nombre employés]*7.5
Taux disponibilité: (1-[Indisponibilté]/[Disponibilté])*100

```Indisponibilite = CALCULATE(SUM([Congé]))+CALCULATE(SUM([Réunion]))+CALCULATE(SUM([Maladie]))

Disponibilité = Disponibilité = CALCULATE(SUM('T_Métiers'[Nombre])*7.5)

Taux disponibilité = AVERAGEX(SUMMARIZE('T_Catégories','T_Catégories'[Métier]), (1-[Indisponibilite]/[Disponibilité])*100)```

Result:

By the way, Let me explain why we don't use merge function and create column instead of Create the relationship and calculate measure? If use merge function and create column, we couldn't filter by month, for it will lead to duplicate value. Unless you do not filter result, you could use merge function and create column.

here is my pbix, please try it.

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Frequent Visitor

Hi,

Thanks for the file and clear explanation! It is what I'm looking for!

I just have a question...I don't understand what you mean by " If you column Code absence and column Date?"

Misen

@v-lili6-msft wrote:

HI, @misen08

After my test, you could do these follow my steps as below:

Step1:

If you (Missing word) column Code absence and column Date?

IF not, then remove one of them and then select column Catégorie click Transform->Pivot table

Announcements

#### 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.

#### Power BI Monthly Update - June 2024

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

#### New forum boards available in Real-Time Intelligence.

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

Top Solution Authors
Top Kudoed Authors