IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

MS SQL Server Discussion :

(MDX) Fonction COALESCEEMPTY


Sujet :

MS SQL Server

  1. #1
    Membre éclairé
    Avatar de Reskibil
    Profil pro
    Inscrit en
    Mai 2007
    Messages
    561
    Détails du profil
    Informations personnelles :
    Âge : 42
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Mai 2007
    Messages : 561
    Points : 815
    Points
    815
    Par défaut (MDX) Fonction COALESCEEMPTY
    Bonjour,

    Suite au conseil de Rudib ici même, j'ai essayé d'intégrer la fonction COALESCEEMPTY dans le but de remplacer des NULL par une valeur quelconque (None en l'occurrence).

    J'ai donc fait ceci :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    WITH member [Dim Employee].[Date Terminated].[DateNone] as '"None"' 
    Member [Dim Employee].[Date Terminated].[Date Terminated] as
    COALESCEEMPTY([Dim Employee].[Date Terminated].[Date Terminated],[Dim Employee].[Date Terminated].[DateNone])
    SELECT NON EMPTY { [Measures].[# Employee Distinct] } ON COLUMNS, 
     NON EMPTY { ([Dim BV Organisation].[Product Line].[Product Line].ALLMEMBERS 
     * [Dim BV Organisation].[Business Unit].[Business Unit].ALLMEMBERS 
     * [Dim Employee].[Employee].[Employee].ALLMEMBERS 
     * [Dim Employee].[Employee Name].[Employee Name].ALLMEMBERS 
    * [Dim Employee].[Date Terminated].[Date Terminated]
     * [Fact TE Details].[TE Details Last Extract Date].[TE Details Last Extract Date].ALLMEMBERS 
     * [Dim Employee].[Date Started].[Date Started].ALLMEMBERS ) } ON ROWS FROM ( 
     SELECT ( { [Dim Time].[Year].&[2007] } ) ON COLUMNS FROM ( 
     SELECT ( { [Dim Employee].[Home Company].&[00153] } ) ON COLUMNS FROM ( 
     SELECT ( { [Dim Employee].[Employee Search Type].&[E], [Dim Employee].[Employee Search Type].&[X] } ) ON COLUMNS FROM ( 
     SELECT ( { [Dim BV Organisation].[Reporting Line].&[I&F], [Dim BV Organisation].[Reporting Line].&[INF] } ) ON COLUMNS FROM BVOMDW))))
    Ca marche sauf qu'il continue de m'afficher des vides pour les valeur NULL au lieu de None.
    None n'est là que pour les tests mais au final, ce sera une date de facon à pouvoir faire un test sur les [Date Terminated].
    N'étant pas familier du MDX, je suppose que j'ai du faire un truc pas bien (encore que le code ci-dessus marche mais pas completement) donc s iquelqu'un voit le probleme, ca m'aiderait beaucoup.

    Merci d'avance de votre aide.

  2. #2
    Membre éprouvé
    Homme Profil pro
    Consultant informatique
    Inscrit en
    Août 2006
    Messages
    730
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 62
    Localisation : France

    Informations professionnelles :
    Activité : Consultant informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Août 2006
    Messages : 730
    Points : 923
    Points
    923
    Par défaut
    tu n'as un conflit de type ?

    ton [Dim Employee].[Date Terminated].[DateNone] est au format date ou varchar ?

  3. #3
    Membre éclairé
    Avatar de Reskibil
    Profil pro
    Inscrit en
    Mai 2007
    Messages
    561
    Détails du profil
    Informations personnelles :
    Âge : 42
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Mai 2007
    Messages : 561
    Points : 815
    Points
    815
    Par défaut
    Bonne question et je à vrai dire, je sais pas.

    En fait j'ai remplacé le None par ça:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    WITH member [Dim Employee].[Date Terminated].[DateNone] as '"09/09/2999 00:00:00"'
    Donc il faudrait peut être changer le type en date alors ? Si oui comment ?

    Edit:
    J'ai essayé ca :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    SELECT NON EMPTY { [Measures].[# Employee Distinct] } ON COLUMNS, 
     NON EMPTY { ([Dim BV Organisation].[Product Line].[Product Line].ALLMEMBERS 
     * [Dim BV Organisation].[Business Unit].[Business Unit].ALLMEMBERS 
     * [Dim Employee].[Employee].[Employee].ALLMEMBERS 
     * [Dim Employee].[Employee Name].[Employee Name].ALLMEMBERS 
    * iif(isempty([Dim Employee].[Date Terminated].[Date Terminated]),'"09/09/2999 00:00:00"',[Dim Employee].[Date Terminated].[Date Terminated].allmembers)
     * [Fact TE Details].[TE Details Last Extract Date].[TE Details Last Extract Date].ALLMEMBERS 
     * [Dim Employee].[Date Started].[Date Started].ALLMEMBERS ) } ON ROWS FROM ( 
     SELECT ( { [Dim Time].[Year].&[2007] } ) ON COLUMNS FROM ( 
     SELECT ( { [Dim Employee].[Home Company].&[00153] } ) ON COLUMNS FROM ( 
     SELECT ( { [Dim Employee].[Employee Search Type].&[E], [Dim Employee].[Employee Search Type].&[X] } ) ON COLUMNS FROM ( 
     SELECT ( { [Dim BV Organisation].[Reporting Line].&[I&F], [Dim BV Organisation].[Reporting Line].&[INF] } ) ON COLUMNS FROM BVOMDW))))
    Sans succès non plus snif.

    En fait, je suis pas attaché au COaLESCEEMPTY ou autre, juste un moyen de remplacer les NULL par autre chose (dans l'idéal, la date ci-dessus).

Discussions similaires

  1. [SSAS] [2K5] MDX fonction LinkMember
    Par fcbad dans le forum SSAS
    Réponses: 0
    Dernier message: 28/04/2010, 14h53
  2. [Cognos 8.2] fonctions MDX sur modèle DMR
    Par yphilogene dans le forum Cognos
    Réponses: 7
    Dernier message: 22/04/2008, 21h46
  3. [MDX] Fonction Topcount
    Par Reskibil dans le forum MS SQL Server
    Réponses: 2
    Dernier message: 28/11/2007, 11h35
  4. MDX fonction sur chaine de caractères (concat(),Substring())
    Par YagamiRaito dans le forum Mondrian
    Réponses: 2
    Dernier message: 16/08/2007, 17h16
  5. Question MDX avec la fonction Iif
    Par toc2000 dans le forum MS SQL Server
    Réponses: 2
    Dernier message: 29/11/2006, 21h14

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo