Forum Discussion
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:
Indisponibilite: [Congé]+[Réunion]+[Maladie]
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:
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:
Indisponibilite: [Congé]+[Réunion]+[Maladie]
Disponibilité: [Nombre employés]*7.5
Taux disponibilité: (1-[Indisponibilté]/[Disponibilté])*100I 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:
Thanks.
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:
Indisponibilite: [Congé]+[Réunion]+[Maladie]
Disponibilité: [Nombre employés]*7.5
Taux disponibilité: (1-[Indisponibilté]/[Disponibilté])*100Indisponibilite = 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.
https://www.dropbox.com/s/66jlstvsmymsznb/Add%20columns%20to%20pivot%20table.pbix?dl=0
Best Regards,
Lin
3 Replies
- v-lili6-msft
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:
Indisponibilite: [Congé]+[Réunion]+[Maladie]
Disponibilité: [Nombre employés]*7.5
Taux disponibilité: (1-[Indisponibilté]/[Disponibilté])*100Indisponibilite = 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.
https://www.dropbox.com/s/66jlstvsmymsznb/Add%20columns%20to%20pivot%20table.pbix?dl=0
Best Regards,
Lin
- misen08Frequent 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
- misen08Frequent 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:
Indisponibilite: [Congé]+[Réunion]+[Maladie]
Disponibilité: [Nombre employés]*7.5
Taux disponibilité: (1-[Indisponibilté]/[Disponibilté])*100I 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:
Thanks.