Forum Discussion

Pier2's avatar
Pier2
Resolver I
2 years ago
Solved

Remove older year

Hello,

I want to remove (circled in red) the first year (as integer value) from a serie.

I'm able to find that value, but unable to set right next step, removing it from the final anwser.

I've try different combinaisons of calculation and filter, but still in a dead end.

Three tables are involved.

  • tblEntreprise
  • tblEntrepriseDonnees
  • CalendrierAnnuel



 

VAR ft= 
CALCULATE( SUM(tblEntrepriseDonnees[sglCoutCapitauxPropres]),
FILTER( CalendrierAnnuel, AND(
CalendrierAnnuel[Année fiscale]>­varPremiereAnne,  USERELATIONSHIP(tblEntreprise[KEntreprise],tblEntrepriseDonnees[FKEntreprise]))))

 

 

6 Replies

  • Try the following :

    VAR varPremiereAnne = MIN(CalendrierAnnuel[Année fiscale])

    RETURN
    CALCULATE(
    SUM(tblEntrepriseDonnees[sglCoutCapitauxPropres]),
    FILTER(
    CalendrierAnnuel,
    CalendrierAnnuel[Année fiscale] > varPremiereAnne
    ),
    USERELATIONSHIP(tblEntreprise[KEntreprise], tblEntrepriseDonnees[FKEntreprise])
    )

    • Pier2's avatar
      Pier2
      Resolver I

      Hello AmiraBedh ,

      Thanks for your help.
      I've try your solution. The result gives an empty chart, unfortunately. We must be close but I dont where's the problem. I would probably done it like you.

      But I can have a sum in a card


      The result is the same when I remove the USERELATIONSHIP part.

      For the fun of it, I remove varPremiereAnne for 5 or  2015. Then I the chart is full.

       

       

      CALCULATE(
      SUM(tblEntrepriseDonnees[sglCoutCapitauxPropres]),
      FILTER(
      CalendrierAnnuel,
      CalendrierAnnuel[Année fiscale] > 5
      ),
      USERELATIONSHIP(tblEntreprise[KEntreprise], tblEntrepriseDonnees[FKEntreprise])
      )

       

       

  • Hello AmiraBedh ,

    What i recently found is that when I substract a number (1 or something else) I see the graph. But everything vanish when remove that substraction or try any kind of addition.

     

    //See something in the graph
    VAR varPremiereAnnee = 
    CALCULATE(
        MIN(tblEntrepriseDonnees[intAnnee]), USERELATIONSHIP(tblEntreprise[KEntreprise],
        tblEntrepriseDonnees[FKEntreprise]) 
    )-1

     

     

     

    // See nothing in the graph
    VAR varPremiereAnnee = 
    CALCULATE(
        MIN(tblEntrepriseDonnees[intAnnee]), USERELATIONSHIP(tblEntreprise[KEntreprise],
        tblEntrepriseDonnees[FKEntreprise]) 
    )

     


    Here's the data model.

     

     

    Data
    tblEntreprise

    KEntreprisetxtEntrepriseNom
    1Karl's Inc
    2Joy's Books Store

     

    CalendrierAnnuel

    Année fiscale
    2013
    2014
    2015
    2016
    2017
    2018
    2019

     

    tblEntrepriseDonnee

    FKEntrepriseintAnneesglCoutCapitauxPropresID
    12015 1
    120160,022
    120170,033
    120180,0254
    22014 5
    220150,026
    220160,007
    220170,088

     

    As you can see, in tblEntrepriseDonnee, on line 1 and 5, there's no number in the column sglCoutCapitauxPropres. That's why I don't want to see them in the graph. But, as on line # 7, I could find a zéro along the way and I want to see it.

    Hope explanations are clear.