Forum Discussion

Sibrulotte's avatar
Sibrulotte
Icon for Helper IV rankHelper IV
2 years ago
Solved

Trouble with Removefilters, yet another

Hi, 

I have a master calender connected to my transactions table, that is connected to a customer table that is connected to a balance table.

 

My measure should look like this:

 

NB_epargnant_31_mai_comp = calculate(distinctcount(Balances[Balances.Customer_ID]), removefilters(Master_calender), filter(balances, Balances[Balance_date] = [Lastyear_end_of_year_date])).
 
So basically, it should retrieve the number of customers I have last year at a specific date ([Lastyear_end_of_year_date] returns a single value), with disregard to any selections made to the master calender to avoid keeping only customers with transaction in the selected period.
 
Unfortonatly, my measure returns filtered resultats anyways 😞
What should I tweak?
  • Well after reviewing and recreating my model a few times over, it was a relationship between two tables that prohibits what I want to do and I'm stuck keeping the bi directionnal relationship for a greater purpose.

     

    Oh well, I've hit the end of my will to add this to my model. Thank you for your patience.

7 Replies

  • Well after reviewing and recreating my model a few times over, it was a relationship between two tables that prohibits what I want to do and I'm stuck keeping the bi directionnal relationship for a greater purpose.

     

    Oh well, I've hit the end of my will to add this to my model. Thank you for your patience.

    • lbendlin's avatar
      lbendlin
      Icon for Super User rankSuper User

      Remember you have CROSSFILTER  at your disposal which allows you to temporarily change the filter directions.

  •  ([Lastyear_end_of_year_date] returns a single value)

    If it does then materialize it into a variable instead of computing the measure for every row.

    • Sibrulotte's avatar
      Sibrulotte
      Icon for Helper IV rankHelper IV

      you mean like this:

       

      NB_epargnant_31_mai_comp = 

      var vLastyear_end_of_year_date = 

      date(max(master_calender.fiscal_year), 05,31)-365
      return

      calculate(distinctcount(Balances[Balances.Customer_ID]), removefilters(Master_calender), filter(balances, Balances[Balance_date] = vLastyear_end_of_year_date))

       

      BTW  this : date(max('Année comptable'[Année comptable]), 05,31)-365 returns th eproper date I am looking for : 2024-05-31 and when I remove selections in my page I get the proper result.

      • lbendlin's avatar
        lbendlin
        Icon for Super User rankSuper User

        var vLastyear_end_of_year_date = 

        edate(max(master_calender.fiscal_year), -12)