Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Arnault_
Resolver III
Resolver III

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.

 

Modelpng.png

 

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.

 

report page.png

 

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.

 

 

 

 

1 ACCEPTED SOLUTION

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.

View solution in original post

2 REPLIES 2
lbendlin
Super User
Super User

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.

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.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.