Forum Discussion

Arnault_'s avatar
Arnault_
Resolver III
4 years ago
Solved

Countx within context transition

Hi All,

 

I am struggling with a context transition problem.

I have preapared a simple data model to illustrate it.

I have:

- 1 transaction table with values that I need to aggregate (in this table there are transactions id with duplicates)

- 1 date table with an active relationship (date_1) and an inactive relationship (date_2)

- 1 table with a list of values (from 1 to 500+) which will be used as an axis (an inactive relationship has been created between the transaction table and this table.

 

 

I want to count the number of occurences (values in the transcation table) and display the number of occurences on a bar chart using the 3rd table as axis.

 

The challenge is:

1/ to ignore duplicates

2/ to apply the right filter context (date_2 instead of date_1)

 

The problem I have is that my measure first applies a filter on date_1 and only then on date_2.

In the attached pbix, my measure is the following ("Count value (w/o dupliactes & based on date_2)". With the current filters on the report page the result should be 7 and not 6. One of the transactions is not taken into account because the "date_1" of this transcation is <> 2020.

 

 

How can I remove the filter context on date_1 and apply it on date_2 only? Please take a look at the attached file because the measure also use TREATAS to link the values from the transcation table and the axis table which makes the scenario a bit more complex.

 

Pbix 

 

Thanks in advance for your help.

 

 

 

 

  • Hi lbendlin , you are right. I have found the answer myself and updated the pbix. I just didn't had time to update the post here. 😉

    Now I am trying to develop the logic further and get the cumulated value (using ALLSELECTED). I have not succeeded yet, but I will post a complete answer if I mange to get the expected result. If you have any idea on how to achieve this it will be welcome.

2 Replies

  • Your pbix already has the anwer?  

    "Count value (w/o dupliactes & based on date_2) v2" modifies the data model to use the other relationship.
    • Arnault_'s avatar
      Arnault_
      Resolver III

      Hi lbendlin , you are right. I have found the answer myself and updated the pbix. I just didn't had time to update the post here. 😉

      Now I am trying to develop the logic further and get the cumulated value (using ALLSELECTED). I have not succeeded yet, but I will post a complete answer if I mange to get the expected result. If you have any idea on how to achieve this it will be welcome.