SlideShare une entreprise Scribd logo
1  sur  16
POWER QUERY
Les FONCTIONS
Cathy Monier
 Auteure du Site CathyAstuce.com
 Auteur des livres
 Power Query et le langage M (Edition ENI)
 Excel 2013 & VBA (Ed. Pearson)
 Tableaux croisés dynamiques (Ed. Pearson – Épuisé)
 Maîtriser Excel 2013 (Ed. Pearson – Épuisé)
 Me Contacter
 www.gemccap.com
 cathy.monier@gemccap.fr
Déroulement de la Session
• Récupérer
Contenu d’un
classeur
• Créer une
fonction récursive
RH
• Utilisation de
#shared
Aide
• Une fonction
récursive sur une
table
API
Meetup
Problématique RH
En France, pour toute personne embauchée en CDD, nous devons considérer plusieurs
contrats qui se suivent pour une même personne comme étant un seul contrat.
Suivi des contrats
Les contrats se suivent et donc n’en font qu’un seul
Les contrats ne se suivent pas, nous avons donc 6 contrats
Fonction récursive
1. Besoin de lire les données de la ligne
précédente
 Utilisation d’un index
 Fusion de la table avec elle-même
2. Schéma de la fonction OUI
NON
Ligne actuel
(table + Entrée)
Sortie+1
=
Entrée ?
debut contrat =
Date entrée
Ligne précédente
Code de la fonction fnGetDebut
(TableContrats as table, ID as number, DateEntree as date) =>
let
LigneTest = Table.SelectRows(TableContrats , each ([Index] = ID-1)),
NbLignes = Table.RowCount(LigneTest),
DateDebut = if NbLignes = 0 then
DateEntree
else
if DateEntree = (LigneTest{0}[Sortie] + #duration(1,0,0,0)) then
fnGetDebut(TableContrats, ID-1,LigneTest{0}[Entree])
else
DateEntree
in
DateDebut
Aide
La méthode #shared pour récupérer la liste des fonctions
Aide Vous trouverez ce tableau de bord sur
• Un partage d’app BI
• Mon site CathyAstuce
Code
 Récupérer l’ensemble des fonctions de Power Query
#shared
 Se limiter aux fonctions
Value.Is([Value], type function)
 Récupérer les métadonnées de la fonction
Value.Metadata(Value.Type([Value]))
 Il peut y avoir jusque 3 exemples, donc recupération dans 3 colonnes de chaque ligne de la liste
[Documentation.Examples]{0} , [Documentation.Examples]{1} , [Documentation.Examples]{2}
Meetup
Comment récupérer l’ensemble des membres du groupe Meetup MSDEVMTL
Meetup
 Documentation https://www.meetup.com/fr-
FR/meetup_api/
 page : la taille de page (nombre maximal de
résultats à chaque réponse)
 offset : la page à retourner.
Exemple, page = 10, offset =0 donne les lignes de
1-10, offset=1 de 11à 20, etc..
 desc : ordre inverse, desc=true
Récupérer la 1ère page
Construire l’URL
 L’URL de connexion : https://api.meetup.com/members?status=past
 Paramètres communs aux requêtes :
• &group_urlname= GroupUrlName
• &key= MeetupApiKey
“https://api.meetup.com/members?status=past" & "&group_urlname=" & GroupUrlName & "&key=" &
MeetupApiKey & "&page=200" & "&offset=0"
 Création d’un paramètre pour chaque page : NumPage = 0
“https://api.meetup.com/members?status=past" & "&group_urlname=" & GroupUrlName & "&key=" &
MeetupApiKey & "&page=200" & "&offset=" & Text.From(NumPage)
 Dès que la table est récupérée, on compte le nombre de lignes afin de savoir s’il faut lire d’autres pages
Table.RowCount(ConvertTable )
Fonction récursive
 Schéma de la fonction
 Combiner les tables
CombineResult = Table.Combine({MaTable , ConvertTable})
 Code de la ligne de récursivité
if NbLignes = 0 then
CombineResult
else
fnGetPages (NumPage + 1, CombineResult )
NON
OUI
NumPage = 0
Resultat = 200 membres
Nb
Membres
<200
Nous sommes arrivés sur la
dernière page
NumPage=+1
Combiner les tables
Code de la fonction
(NumPage as number, MaTable as table) =>
let
Source = Json.Document(Web.Contents("https://api.meetup.com/members?status=past" &
"&group_urlname=" & GroupUrlName & "&key=" & MeetupApiKey & "&page=200" & "&offset=" &
Text.From(NumPage))),
Navigation = Source[results],
ConvertTable = Table.FromList(Navigation , Splitter.SplitByNothing(), null, null, ExtraValues.Error),
NbLignes = Table.RowCount(ConvertTable),
CombineResult = Table.Combine({MaTable , ConvertTable}),
Resultat = if NbLignes = 0 then CombineResult else fnGetPages (NumPage + 1, CombineResult )
in
Resultat
Question(s) – Réponse(s)

Contenu connexe

En vedette

Sophie Marchand: Cas power bi de a à z
Sophie Marchand: Cas power bi de a à zSophie Marchand: Cas power bi de a à z
Sophie Marchand: Cas power bi de a à zMSDEVMTL
 
Microsoft Modern Analytics
Microsoft Modern AnalyticsMicrosoft Modern Analytics
Microsoft Modern AnalyticsMSDEVMTL
 
Robert Luong: Analyse prédictive dans Excel
Robert Luong: Analyse prédictive dans ExcelRobert Luong: Analyse prédictive dans Excel
Robert Luong: Analyse prédictive dans ExcelMSDEVMTL
 
Ssis 2016 RC3
Ssis 2016 RC3Ssis 2016 RC3
Ssis 2016 RC3MSDEVMTL
 
Introduction à Application Insights
Introduction à Application InsightsIntroduction à Application Insights
Introduction à Application InsightsMSDEVMTL
 
Groupe Montreal Modern Excel and Power BI 2016 2017
Groupe Montreal Modern Excel and Power BI 2016 2017Groupe Montreal Modern Excel and Power BI 2016 2017
Groupe Montreal Modern Excel and Power BI 2016 2017MSDEVMTL
 
Guy Barrette: Afficher des données en temps réel dans PowerBI
Guy Barrette: Afficher des données en temps réel dans PowerBIGuy Barrette: Afficher des données en temps réel dans PowerBI
Guy Barrette: Afficher des données en temps réel dans PowerBIMSDEVMTL
 
How ddd, cqrs and event sourcing constitute the architecture of the future
How ddd, cqrs and event sourcing constitute the architecture of the futureHow ddd, cqrs and event sourcing constitute the architecture of the future
How ddd, cqrs and event sourcing constitute the architecture of the futureMSDEVMTL
 
La sociedad colonial 2017, adobe acrobat, 14 carillas
La sociedad colonial 2017, adobe acrobat, 14 carillasLa sociedad colonial 2017, adobe acrobat, 14 carillas
La sociedad colonial 2017, adobe acrobat, 14 carillasLiceo Academia Iquique
 
Stephane Lapointe, Frank Boucher & Alexandre Brisebois: Les micro-services et...
Stephane Lapointe, Frank Boucher & Alexandre Brisebois: Les micro-services et...Stephane Lapointe, Frank Boucher & Alexandre Brisebois: Les micro-services et...
Stephane Lapointe, Frank Boucher & Alexandre Brisebois: Les micro-services et...MSDEVMTL
 
SQL Server 2016 novelties
SQL Server 2016 noveltiesSQL Server 2016 novelties
SQL Server 2016 noveltiesMSDEVMTL
 
Investigando a própria prática em uma Trajetória Hipotética de Aprendizagem n...
Investigando a própria prática em uma Trajetória Hipotética de Aprendizagem n...Investigando a própria prática em uma Trajetória Hipotética de Aprendizagem n...
Investigando a própria prática em uma Trajetória Hipotética de Aprendizagem n...Wendel Silva
 
SQL Server 2016 SSRS and BI
SQL Server 2016 SSRS and BISQL Server 2016 SSRS and BI
SQL Server 2016 SSRS and BIMSDEVMTL
 
Retour d’expérience de Sarenza sur la façon de piloter un projet Power BI
Retour d’expérience de Sarenza sur la façon de piloter un projet Power BIRetour d’expérience de Sarenza sur la façon de piloter un projet Power BI
Retour d’expérience de Sarenza sur la façon de piloter un projet Power BIMicrosoft Technet France
 
MARTA Hackathon Data Presentation
MARTA Hackathon Data PresentationMARTA Hackathon Data Presentation
MARTA Hackathon Data PresentationSandbox ATL
 
Journées SQL Server 2012 Attentes et Performances
Journées SQL Server 2012   Attentes et PerformancesJournées SQL Server 2012   Attentes et Performances
Journées SQL Server 2012 Attentes et PerformancesDavid BAFFALEUF
 
[JSS2015] Nouveautés SSIS SSRS 2016
[JSS2015] Nouveautés SSIS SSRS 2016[JSS2015] Nouveautés SSIS SSRS 2016
[JSS2015] Nouveautés SSIS SSRS 2016GUSS
 
Tp Sql Server Integration Services 2008
Tp  Sql Server Integration Services  2008Tp  Sql Server Integration Services  2008
Tp Sql Server Integration Services 2008Abdelouahed Abdou
 
SQL Server 2016 Reporting Services
SQL Server 2016 Reporting ServicesSQL Server 2016 Reporting Services
SQL Server 2016 Reporting ServicesEduardo Castro
 

En vedette (20)

Sophie Marchand: Cas power bi de a à z
Sophie Marchand: Cas power bi de a à zSophie Marchand: Cas power bi de a à z
Sophie Marchand: Cas power bi de a à z
 
Microsoft Modern Analytics
Microsoft Modern AnalyticsMicrosoft Modern Analytics
Microsoft Modern Analytics
 
Robert Luong: Analyse prédictive dans Excel
Robert Luong: Analyse prédictive dans ExcelRobert Luong: Analyse prédictive dans Excel
Robert Luong: Analyse prédictive dans Excel
 
Ssis 2016 RC3
Ssis 2016 RC3Ssis 2016 RC3
Ssis 2016 RC3
 
Introduction à Application Insights
Introduction à Application InsightsIntroduction à Application Insights
Introduction à Application Insights
 
Groupe Montreal Modern Excel and Power BI 2016 2017
Groupe Montreal Modern Excel and Power BI 2016 2017Groupe Montreal Modern Excel and Power BI 2016 2017
Groupe Montreal Modern Excel and Power BI 2016 2017
 
Guy Barrette: Afficher des données en temps réel dans PowerBI
Guy Barrette: Afficher des données en temps réel dans PowerBIGuy Barrette: Afficher des données en temps réel dans PowerBI
Guy Barrette: Afficher des données en temps réel dans PowerBI
 
How ddd, cqrs and event sourcing constitute the architecture of the future
How ddd, cqrs and event sourcing constitute the architecture of the futureHow ddd, cqrs and event sourcing constitute the architecture of the future
How ddd, cqrs and event sourcing constitute the architecture of the future
 
La sociedad colonial 2017, adobe acrobat, 14 carillas
La sociedad colonial 2017, adobe acrobat, 14 carillasLa sociedad colonial 2017, adobe acrobat, 14 carillas
La sociedad colonial 2017, adobe acrobat, 14 carillas
 
Stephane Lapointe, Frank Boucher & Alexandre Brisebois: Les micro-services et...
Stephane Lapointe, Frank Boucher & Alexandre Brisebois: Les micro-services et...Stephane Lapointe, Frank Boucher & Alexandre Brisebois: Les micro-services et...
Stephane Lapointe, Frank Boucher & Alexandre Brisebois: Les micro-services et...
 
SQL Server 2016 novelties
SQL Server 2016 noveltiesSQL Server 2016 novelties
SQL Server 2016 novelties
 
Investigando a própria prática em uma Trajetória Hipotética de Aprendizagem n...
Investigando a própria prática em uma Trajetória Hipotética de Aprendizagem n...Investigando a própria prática em uma Trajetória Hipotética de Aprendizagem n...
Investigando a própria prática em uma Trajetória Hipotética de Aprendizagem n...
 
SQL Server 2016 SSRS and BI
SQL Server 2016 SSRS and BISQL Server 2016 SSRS and BI
SQL Server 2016 SSRS and BI
 
Retour d’expérience de Sarenza sur la façon de piloter un projet Power BI
Retour d’expérience de Sarenza sur la façon de piloter un projet Power BIRetour d’expérience de Sarenza sur la façon de piloter un projet Power BI
Retour d’expérience de Sarenza sur la façon de piloter un projet Power BI
 
Reactivo de albumina
Reactivo de albuminaReactivo de albumina
Reactivo de albumina
 
MARTA Hackathon Data Presentation
MARTA Hackathon Data PresentationMARTA Hackathon Data Presentation
MARTA Hackathon Data Presentation
 
Journées SQL Server 2012 Attentes et Performances
Journées SQL Server 2012   Attentes et PerformancesJournées SQL Server 2012   Attentes et Performances
Journées SQL Server 2012 Attentes et Performances
 
[JSS2015] Nouveautés SSIS SSRS 2016
[JSS2015] Nouveautés SSIS SSRS 2016[JSS2015] Nouveautés SSIS SSRS 2016
[JSS2015] Nouveautés SSIS SSRS 2016
 
Tp Sql Server Integration Services 2008
Tp  Sql Server Integration Services  2008Tp  Sql Server Integration Services  2008
Tp Sql Server Integration Services 2008
 
SQL Server 2016 Reporting Services
SQL Server 2016 Reporting ServicesSQL Server 2016 Reporting Services
SQL Server 2016 Reporting Services
 

Similaire à Cathy Monier: Power Query et Power BI

Spark - au dela du dataframe avec Tungsten et Catalyst
Spark - au dela du dataframe avec Tungsten et CatalystSpark - au dela du dataframe avec Tungsten et Catalyst
Spark - au dela du dataframe avec Tungsten et CatalystMathieu Goeminne
 
Linq et Entity framework
Linq et Entity frameworkLinq et Entity framework
Linq et Entity frameworkDNG Consulting
 
Découverte du moteur de rendu du projet Spartan
Découverte du moteur de rendu du projet SpartanDécouverte du moteur de rendu du projet Spartan
Découverte du moteur de rendu du projet SpartanMicrosoft
 
Chorégraphie distribuée à partir d’un processus d’orchestration BPMN
Chorégraphie distribuée à partir d’un processus d’orchestration BPMNChorégraphie distribuée à partir d’un processus d’orchestration BPMN
Chorégraphie distribuée à partir d’un processus d’orchestration BPMNmmchaal
 
coursMLD.pdf djnvvvvvvvvvvvvvvvv jd dvjjjjjjjjjjjjjjj
coursMLD.pdf djnvvvvvvvvvvvvvvvv jd           dvjjjjjjjjjjjjjjjcoursMLD.pdf djnvvvvvvvvvvvvvvvv jd           dvjjjjjjjjjjjjjjj
coursMLD.pdf djnvvvvvvvvvvvvvvvv jd dvjjjjjjjjjjjjjjjobaghat60
 
coursMLD.pdfnw wx c c c c c c cc c c c c c cckck
coursMLD.pdfnw wx c c c c c c cc c c c c c cckckcoursMLD.pdfnw wx c c c c c c cc c c c c c cckck
coursMLD.pdfnw wx c c c c c c cc c c c c c cckckobaghat60
 
coursMLD.pdf dnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn...
coursMLD.pdf dnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn...coursMLD.pdf dnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn...
coursMLD.pdf dnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn...obaghat60
 
Bowap formation-business-object-webintelligence-perfectionnement
Bowap formation-business-object-webintelligence-perfectionnementBowap formation-business-object-webintelligence-perfectionnement
Bowap formation-business-object-webintelligence-perfectionnementCERTyou Formation
 
Formation Efficy CRM - Technical training
Formation Efficy CRM - Technical trainingFormation Efficy CRM - Technical training
Formation Efficy CRM - Technical trainingEfficy CRM
 
Oxalide Workshop #3 - Elasticearch, an overview
Oxalide Workshop #3 - Elasticearch, an overviewOxalide Workshop #3 - Elasticearch, an overview
Oxalide Workshop #3 - Elasticearch, an overviewLudovic Piot
 
Oxalide Academy : Workshop #3 Elastic Search
Oxalide Academy : Workshop #3 Elastic SearchOxalide Academy : Workshop #3 Elastic Search
Oxalide Academy : Workshop #3 Elastic SearchOxalide
 
Paris Tug - Session d'octobre
Paris Tug - Session d'octobreParis Tug - Session d'octobre
Paris Tug - Session d'octobreGeoffrey Felix
 
Moteurs de recherche et web sémantique
Moteurs de recherche et web sémantiqueMoteurs de recherche et web sémantique
Moteurs de recherche et web sémantiqueAntidot
 
Génération automatique de texte
Génération automatique de texteGénération automatique de texte
Génération automatique de texteEstelle Delpech
 
Comment passer de SEO à SEO + data
Comment passer de SEO à SEO + dataComment passer de SEO à SEO + data
Comment passer de SEO à SEO + dataSEO CAMP
 
L'ABC d'un déploiement réussi - WordCamp Montréal 2018
L'ABC d'un déploiement réussi - WordCamp Montréal 2018L'ABC d'un déploiement réussi - WordCamp Montréal 2018
L'ABC d'un déploiement réussi - WordCamp Montréal 2018Maxime Jobin
 
Stream processing et SQL
Stream processing et SQLStream processing et SQL
Stream processing et SQLBruno Bonnin
 

Similaire à Cathy Monier: Power Query et Power BI (20)

Spark - au dela du dataframe avec Tungsten et Catalyst
Spark - au dela du dataframe avec Tungsten et CatalystSpark - au dela du dataframe avec Tungsten et Catalyst
Spark - au dela du dataframe avec Tungsten et Catalyst
 
Linq et Entity framework
Linq et Entity frameworkLinq et Entity framework
Linq et Entity framework
 
Découverte du moteur de rendu du projet Spartan
Découverte du moteur de rendu du projet SpartanDécouverte du moteur de rendu du projet Spartan
Découverte du moteur de rendu du projet Spartan
 
Chorégraphie distribuée à partir d’un processus d’orchestration BPMN
Chorégraphie distribuée à partir d’un processus d’orchestration BPMNChorégraphie distribuée à partir d’un processus d’orchestration BPMN
Chorégraphie distribuée à partir d’un processus d’orchestration BPMN
 
coursMLD.pdf djnvvvvvvvvvvvvvvvv jd dvjjjjjjjjjjjjjjj
coursMLD.pdf djnvvvvvvvvvvvvvvvv jd           dvjjjjjjjjjjjjjjjcoursMLD.pdf djnvvvvvvvvvvvvvvvv jd           dvjjjjjjjjjjjjjjj
coursMLD.pdf djnvvvvvvvvvvvvvvvv jd dvjjjjjjjjjjjjjjj
 
coursMLD.pdfnw wx c c c c c c cc c c c c c cckck
coursMLD.pdfnw wx c c c c c c cc c c c c c cckckcoursMLD.pdfnw wx c c c c c c cc c c c c c cckck
coursMLD.pdfnw wx c c c c c c cc c c c c c cckck
 
coursMLD.pdf dnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn...
coursMLD.pdf dnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn...coursMLD.pdf dnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn...
coursMLD.pdf dnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn...
 
Sql &amp; excel
Sql &amp; excelSql &amp; excel
Sql &amp; excel
 
Bowap formation-business-object-webintelligence-perfectionnement
Bowap formation-business-object-webintelligence-perfectionnementBowap formation-business-object-webintelligence-perfectionnement
Bowap formation-business-object-webintelligence-perfectionnement
 
ADO_NET_complet.pdf
ADO_NET_complet.pdfADO_NET_complet.pdf
ADO_NET_complet.pdf
 
Formation Efficy CRM - Technical training
Formation Efficy CRM - Technical trainingFormation Efficy CRM - Technical training
Formation Efficy CRM - Technical training
 
Presentation JPA
Presentation JPAPresentation JPA
Presentation JPA
 
Oxalide Workshop #3 - Elasticearch, an overview
Oxalide Workshop #3 - Elasticearch, an overviewOxalide Workshop #3 - Elasticearch, an overview
Oxalide Workshop #3 - Elasticearch, an overview
 
Oxalide Academy : Workshop #3 Elastic Search
Oxalide Academy : Workshop #3 Elastic SearchOxalide Academy : Workshop #3 Elastic Search
Oxalide Academy : Workshop #3 Elastic Search
 
Paris Tug - Session d'octobre
Paris Tug - Session d'octobreParis Tug - Session d'octobre
Paris Tug - Session d'octobre
 
Moteurs de recherche et web sémantique
Moteurs de recherche et web sémantiqueMoteurs de recherche et web sémantique
Moteurs de recherche et web sémantique
 
Génération automatique de texte
Génération automatique de texteGénération automatique de texte
Génération automatique de texte
 
Comment passer de SEO à SEO + data
Comment passer de SEO à SEO + dataComment passer de SEO à SEO + data
Comment passer de SEO à SEO + data
 
L'ABC d'un déploiement réussi - WordCamp Montréal 2018
L'ABC d'un déploiement réussi - WordCamp Montréal 2018L'ABC d'un déploiement réussi - WordCamp Montréal 2018
L'ABC d'un déploiement réussi - WordCamp Montréal 2018
 
Stream processing et SQL
Stream processing et SQLStream processing et SQL
Stream processing et SQL
 

Plus de MSDEVMTL

Intro grpc.net
Intro  grpc.netIntro  grpc.net
Intro grpc.netMSDEVMTL
 
Grpc and asp.net partie 2
Grpc and asp.net partie 2Grpc and asp.net partie 2
Grpc and asp.net partie 2MSDEVMTL
 
Property based testing
Property based testingProperty based testing
Property based testingMSDEVMTL
 
Improve cloud visibility and cost in Microsoft Azure
Improve cloud visibility and cost in Microsoft AzureImprove cloud visibility and cost in Microsoft Azure
Improve cloud visibility and cost in Microsoft AzureMSDEVMTL
 
Return on Ignite 2019: Azure, .NET, A.I. & Data
Return on Ignite 2019: Azure, .NET, A.I. & DataReturn on Ignite 2019: Azure, .NET, A.I. & Data
Return on Ignite 2019: Azure, .NET, A.I. & DataMSDEVMTL
 
C sharp 8.0 new features
C sharp 8.0 new featuresC sharp 8.0 new features
C sharp 8.0 new featuresMSDEVMTL
 
Asp.net core 3
Asp.net core 3Asp.net core 3
Asp.net core 3MSDEVMTL
 
MSDEVMTL Informations 2019
MSDEVMTL Informations 2019MSDEVMTL Informations 2019
MSDEVMTL Informations 2019MSDEVMTL
 
Common features in webapi aspnetcore
Common features in webapi aspnetcoreCommon features in webapi aspnetcore
Common features in webapi aspnetcoreMSDEVMTL
 
Groupe Excel et Power BI - Rencontre du 25 septembre 2018
Groupe Excel et Power BI  - Rencontre du 25 septembre 2018Groupe Excel et Power BI  - Rencontre du 25 septembre 2018
Groupe Excel et Power BI - Rencontre du 25 septembre 2018MSDEVMTL
 
Api gateway
Api gatewayApi gateway
Api gatewayMSDEVMTL
 
Common features in webapi aspnetcore
Common features in webapi aspnetcoreCommon features in webapi aspnetcore
Common features in webapi aspnetcoreMSDEVMTL
 
Stephane Lapointe: Governance in Azure, keep control of your environments
Stephane Lapointe: Governance in Azure, keep control of your environmentsStephane Lapointe: Governance in Azure, keep control of your environments
Stephane Lapointe: Governance in Azure, keep control of your environmentsMSDEVMTL
 
Eric Routhier: Garder le contrôle sur vos coûts Azure
Eric Routhier: Garder le contrôle sur vos coûts AzureEric Routhier: Garder le contrôle sur vos coûts Azure
Eric Routhier: Garder le contrôle sur vos coûts AzureMSDEVMTL
 
Data science presentation
Data science presentationData science presentation
Data science presentationMSDEVMTL
 
Michel Ouellette + Gabriel Lainesse: Process Automation & Data Analytics at S...
Michel Ouellette + Gabriel Lainesse: Process Automation & Data Analytics at S...Michel Ouellette + Gabriel Lainesse: Process Automation & Data Analytics at S...
Michel Ouellette + Gabriel Lainesse: Process Automation & Data Analytics at S...MSDEVMTL
 
Open id connect, azure ad, angular 5, web api core
Open id connect, azure ad, angular 5, web api coreOpen id connect, azure ad, angular 5, web api core
Open id connect, azure ad, angular 5, web api coreMSDEVMTL
 
Yoann Clombe : Fail fast, iterate quickly with power bi and google analytics
Yoann Clombe : Fail fast, iterate quickly with power bi and google analyticsYoann Clombe : Fail fast, iterate quickly with power bi and google analytics
Yoann Clombe : Fail fast, iterate quickly with power bi and google analyticsMSDEVMTL
 
CAE: etude de cas - Rolling Average
CAE: etude de cas - Rolling AverageCAE: etude de cas - Rolling Average
CAE: etude de cas - Rolling AverageMSDEVMTL
 
CAE: etude de cas
CAE: etude de casCAE: etude de cas
CAE: etude de casMSDEVMTL
 

Plus de MSDEVMTL (20)

Intro grpc.net
Intro  grpc.netIntro  grpc.net
Intro grpc.net
 
Grpc and asp.net partie 2
Grpc and asp.net partie 2Grpc and asp.net partie 2
Grpc and asp.net partie 2
 
Property based testing
Property based testingProperty based testing
Property based testing
 
Improve cloud visibility and cost in Microsoft Azure
Improve cloud visibility and cost in Microsoft AzureImprove cloud visibility and cost in Microsoft Azure
Improve cloud visibility and cost in Microsoft Azure
 
Return on Ignite 2019: Azure, .NET, A.I. & Data
Return on Ignite 2019: Azure, .NET, A.I. & DataReturn on Ignite 2019: Azure, .NET, A.I. & Data
Return on Ignite 2019: Azure, .NET, A.I. & Data
 
C sharp 8.0 new features
C sharp 8.0 new featuresC sharp 8.0 new features
C sharp 8.0 new features
 
Asp.net core 3
Asp.net core 3Asp.net core 3
Asp.net core 3
 
MSDEVMTL Informations 2019
MSDEVMTL Informations 2019MSDEVMTL Informations 2019
MSDEVMTL Informations 2019
 
Common features in webapi aspnetcore
Common features in webapi aspnetcoreCommon features in webapi aspnetcore
Common features in webapi aspnetcore
 
Groupe Excel et Power BI - Rencontre du 25 septembre 2018
Groupe Excel et Power BI  - Rencontre du 25 septembre 2018Groupe Excel et Power BI  - Rencontre du 25 septembre 2018
Groupe Excel et Power BI - Rencontre du 25 septembre 2018
 
Api gateway
Api gatewayApi gateway
Api gateway
 
Common features in webapi aspnetcore
Common features in webapi aspnetcoreCommon features in webapi aspnetcore
Common features in webapi aspnetcore
 
Stephane Lapointe: Governance in Azure, keep control of your environments
Stephane Lapointe: Governance in Azure, keep control of your environmentsStephane Lapointe: Governance in Azure, keep control of your environments
Stephane Lapointe: Governance in Azure, keep control of your environments
 
Eric Routhier: Garder le contrôle sur vos coûts Azure
Eric Routhier: Garder le contrôle sur vos coûts AzureEric Routhier: Garder le contrôle sur vos coûts Azure
Eric Routhier: Garder le contrôle sur vos coûts Azure
 
Data science presentation
Data science presentationData science presentation
Data science presentation
 
Michel Ouellette + Gabriel Lainesse: Process Automation & Data Analytics at S...
Michel Ouellette + Gabriel Lainesse: Process Automation & Data Analytics at S...Michel Ouellette + Gabriel Lainesse: Process Automation & Data Analytics at S...
Michel Ouellette + Gabriel Lainesse: Process Automation & Data Analytics at S...
 
Open id connect, azure ad, angular 5, web api core
Open id connect, azure ad, angular 5, web api coreOpen id connect, azure ad, angular 5, web api core
Open id connect, azure ad, angular 5, web api core
 
Yoann Clombe : Fail fast, iterate quickly with power bi and google analytics
Yoann Clombe : Fail fast, iterate quickly with power bi and google analyticsYoann Clombe : Fail fast, iterate quickly with power bi and google analytics
Yoann Clombe : Fail fast, iterate quickly with power bi and google analytics
 
CAE: etude de cas - Rolling Average
CAE: etude de cas - Rolling AverageCAE: etude de cas - Rolling Average
CAE: etude de cas - Rolling Average
 
CAE: etude de cas
CAE: etude de casCAE: etude de cas
CAE: etude de cas
 

Cathy Monier: Power Query et Power BI

  • 2. Cathy Monier  Auteure du Site CathyAstuce.com  Auteur des livres  Power Query et le langage M (Edition ENI)  Excel 2013 & VBA (Ed. Pearson)  Tableaux croisés dynamiques (Ed. Pearson – Épuisé)  Maîtriser Excel 2013 (Ed. Pearson – Épuisé)  Me Contacter  www.gemccap.com  cathy.monier@gemccap.fr
  • 3. Déroulement de la Session • Récupérer Contenu d’un classeur • Créer une fonction récursive RH • Utilisation de #shared Aide • Une fonction récursive sur une table API Meetup
  • 4. Problématique RH En France, pour toute personne embauchée en CDD, nous devons considérer plusieurs contrats qui se suivent pour une même personne comme étant un seul contrat.
  • 5. Suivi des contrats Les contrats se suivent et donc n’en font qu’un seul Les contrats ne se suivent pas, nous avons donc 6 contrats
  • 6. Fonction récursive 1. Besoin de lire les données de la ligne précédente  Utilisation d’un index  Fusion de la table avec elle-même 2. Schéma de la fonction OUI NON Ligne actuel (table + Entrée) Sortie+1 = Entrée ? debut contrat = Date entrée Ligne précédente
  • 7. Code de la fonction fnGetDebut (TableContrats as table, ID as number, DateEntree as date) => let LigneTest = Table.SelectRows(TableContrats , each ([Index] = ID-1)), NbLignes = Table.RowCount(LigneTest), DateDebut = if NbLignes = 0 then DateEntree else if DateEntree = (LigneTest{0}[Sortie] + #duration(1,0,0,0)) then fnGetDebut(TableContrats, ID-1,LigneTest{0}[Entree]) else DateEntree in DateDebut
  • 8. Aide La méthode #shared pour récupérer la liste des fonctions
  • 9. Aide Vous trouverez ce tableau de bord sur • Un partage d’app BI • Mon site CathyAstuce
  • 10. Code  Récupérer l’ensemble des fonctions de Power Query #shared  Se limiter aux fonctions Value.Is([Value], type function)  Récupérer les métadonnées de la fonction Value.Metadata(Value.Type([Value]))  Il peut y avoir jusque 3 exemples, donc recupération dans 3 colonnes de chaque ligne de la liste [Documentation.Examples]{0} , [Documentation.Examples]{1} , [Documentation.Examples]{2}
  • 11. Meetup Comment récupérer l’ensemble des membres du groupe Meetup MSDEVMTL
  • 12. Meetup  Documentation https://www.meetup.com/fr- FR/meetup_api/  page : la taille de page (nombre maximal de résultats à chaque réponse)  offset : la page à retourner. Exemple, page = 10, offset =0 donne les lignes de 1-10, offset=1 de 11à 20, etc..  desc : ordre inverse, desc=true
  • 13. Récupérer la 1ère page Construire l’URL  L’URL de connexion : https://api.meetup.com/members?status=past  Paramètres communs aux requêtes : • &group_urlname= GroupUrlName • &key= MeetupApiKey “https://api.meetup.com/members?status=past" & "&group_urlname=" & GroupUrlName & "&key=" & MeetupApiKey & "&page=200" & "&offset=0"  Création d’un paramètre pour chaque page : NumPage = 0 “https://api.meetup.com/members?status=past" & "&group_urlname=" & GroupUrlName & "&key=" & MeetupApiKey & "&page=200" & "&offset=" & Text.From(NumPage)  Dès que la table est récupérée, on compte le nombre de lignes afin de savoir s’il faut lire d’autres pages Table.RowCount(ConvertTable )
  • 14. Fonction récursive  Schéma de la fonction  Combiner les tables CombineResult = Table.Combine({MaTable , ConvertTable})  Code de la ligne de récursivité if NbLignes = 0 then CombineResult else fnGetPages (NumPage + 1, CombineResult ) NON OUI NumPage = 0 Resultat = 200 membres Nb Membres <200 Nous sommes arrivés sur la dernière page NumPage=+1 Combiner les tables
  • 15. Code de la fonction (NumPage as number, MaTable as table) => let Source = Json.Document(Web.Contents("https://api.meetup.com/members?status=past" & "&group_urlname=" & GroupUrlName & "&key=" & MeetupApiKey & "&page=200" & "&offset=" & Text.From(NumPage))), Navigation = Source[results], ConvertTable = Table.FromList(Navigation , Splitter.SplitByNothing(), null, null, ExtraValues.Error), NbLignes = Table.RowCount(ConvertTable), CombineResult = Table.Combine({MaTable , ConvertTable}), Resultat = if NbLignes = 0 then CombineResult else fnGetPages (NumPage + 1, CombineResult ) in Resultat