2 Replies Latest reply: Mar 22, 2017 5:41 AM by omar bensalem RSS

    If Condition in a table

    omar bensalem

      Hi everyone, ( stalwar1),

      Here is my table:

      Dimension: Pays, column : month of date

      measure:

      if pays = maroc  then :

      Count({<[Year of date]={$(=max([Year of date]))}, [Month of date]=, Code_Ligne={'MAR'}, Groupe_Complet_Vide = {G,C},

      Dossier = {"=Count({<[Month of date]=, Code_Ligne={'MAR'}, Groupe_Complet_Vide = {G,C}>}Aggr(COUNT({<[Month of date]=, Code_Ligne={'MAR'}, Groupe_Complet_Vide = {G,C}>} Code_Carrier&Plaque),Date_Embarquement,Plaque))=1"}>} Dossier)

      ,

       

      if pays <> maroc then:

      Count({<[Year of date]={$(=max([Year of date]))}, [Month of date]=,Groupe_Complet_Vide={c,C,G}>}Dossier)

       

      here is how I wrote it :

       

      if(Pays='Maroc',

      Count({<[Year of date]={$(=max([Year of date]))}, [Month of date]=, Code_Ligne={'MAR'}, Groupe_Complet_Vide = {G,C},

      Dossier = {"=Count({<[Month of date]=, Code_Ligne={'MAR'}, Groupe_Complet_Vide = {G,C}>}Aggr(COUNT({<[Month of date]=, Code_Ligne={'MAR'}, Groupe_Complet_Vide = {G,C}>} Code_Carrier&Plaque),Date_Embarquement,Plaque))=1"}>} Dossier)

      ,

      if(Pays<>'Maroc',

      Count({<[Year of date]={$(=max([Year of date]))}, [Month of date]=,Groupe_Complet_Vide={c,C,G}>}Dossier)

      ))

       

      result:

      Capture.PNG

       

      What I want is, even so I select a month, my table must not change ; but with the way it is, there is some changes in the line Maroc when I select a month:

       

      See: I select Fev; only the value for Maroc on Fev does not change, Janv and Mars does change in Maroc:

      Capture.PNG

       

      Now, if my expression was only treating the Maroc part:

       

      Count({<[Year of date]={$(=max([Year of date]))}, [Month of date]=, Code_Ligne={'MAR'}, Groupe_Complet_Vide = {G,C},

      Dossier = {"=Count({<[Month of date]=, Code_Ligne={'MAR'}, Groupe_Complet_Vide = {G,C}>}Aggr(COUNT({<[Month of date]=, Code_Ligne={'MAR'}, Groupe_Complet_Vide = {G,C}>} Code_Carrier&Plaque),Date_Embarquement,Plaque))=1"}>} Dossier)

       

      , the table won't be afffected with a selection of a Month of date

       

      But when there is an If condition, Maroc is always changing when I select a month..

       

      Any idea on how should I alter my measure?

      tHANKS