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.
This is simplified version of my table:
Category |
A |
A |
B |
B |
C |
C |
C |
So I want to include all the C rows but filter some A and B rows based on if they are found in different table. C rows are never found in other table so I have to somehow exclude them from the filtering. So end table should look something like this :
Category |
A |
B |
C |
C |
C |
How can I achieve this?
Solved! Go to Solution.
Hi @Vesa91 ,
Thanks @PawelWrona for the quick reply and solution. Here is my alternative approach for your reference:
(1)This is my test data.
Table1:
Table2:
(2)We can create a table and then the result is as follows.
Table = UNION(EXCEPT('Table1','Table2'),'Table2')
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello. You could either merge tables in Power Query, to bring new column to first table informing you whether there is a match between tables or not. You could also load both tables into the model, and create relationship between them based on the common column. When they are in the model, you could use 2nd table from your example to filter the first table. Let me know if more details are needed.
Hey and thanks for the response. I have already brought them both (and many other tables to my model) but I don't know how to use other tables' columns as filters in visuals without losing the C rows from the visual.
Ok, I am still not sure how much your model is simplified, but I provided the following:
This should work based on my limited knowledge of your model. I have a Main table like this:
Additional table that looks like this:
There is a following relationship setup:
And here is the code for a measure:
Okay thank you, that seems promising but I am just too much of a beginneer to really wrap my head around how to use that measure. I can however try to elaborate my situation:
Main table
Category | ID | |
A | 1 | |
A | 2 | |
B | 3 | |
B | 4 | |
C | 5 | |
C | 6 | |
C | 7 |
Additional table
ID | ||
1 | ||
3 | ||
6 | ||
22 | ||
33 | ||
55 | ||
66 |
I need to make a pie chart that has all the C rows from the main table and only the A and B rows that match with the additional table ID. I have already accomplished this by using Power Query where I just take C rows in one query and filter the A and B rows with additional table in an other query and append the two together and load that table in my model and connect that with 1:1 connection to my main table. My visualisation has multiple other filters like date and such that needs the original main table data too so I need both.
My solution however seems little bit forced to me but I'll take it if I can't do it any other way. What I was trying to do is use main table data in pie chart visualisation and do visualisation level filtering so that I don't have to make new table all together.
So, you case is almost identical as the one that I used. You will setup the relationship as I did, but based on the ID column in both tables. Then, I understand that you will be filtering the data based on the IDs, not some other columns. In this case, DAX Measure will change like this:
Hey again and thanks for help and support. This almost seems to work. I am not sure if I am doing it correctly so I try explain: I created this measure and used is as value in my pie chart and then when I filtered out non-matching rows in additional table, values seemed to all have category C values plus their real value. So it returned correct amount for category C (though the label was empty) and for every other category correct amount plus value of that empty category.
If we could see your output vs expected value that would be much easier to discuss. But based on your description I think you are doing it correctly.
Okay I spent some time looking at the measure. I think when the additional table is filtered, it goes to calculate function and counts the number of C-rows even in cases of A and B and by so inflating their value.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
104 | |
77 | |
67 | |
63 |
User | Count |
---|---|
144 | |
107 | |
105 | |
82 | |
69 |