Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hello All,
I have 2 tables,
Table A
Cat | Sub Cat | Act | concat | metric |
abc | kjl | yu | ff- gg | thm |
cba | df | yu | kk - ll | thm |
abc | ad | yu | yy - jj | thm |
cba | df | yu | kk - ll | thm |
drf | sdf | yu | yy - jj | thm |
kjh | ui | qw | yy - jj | thm |
drf | adfg | qw | yy - jj | thm |
drf | sdf | qw | yy - jj | thm |
drf | adfg | qw | ff- gg | thm |
kjh | ui | qw | kk - ll | thm |
kjh | ui | qw | yy - jj | thm |
kjh | ui | qw | ff- gg | thm |
kjh | ui | qw | kk - ll | thm |
Table B
Cat | Sub Cat | Act | concat | cust | metric | trad |
abc | kjl | yu | ff- gg | gf | thm | dgdf |
cba | df | yu | kk - ll | gf | thm | dgdf |
abc | ad | yu | yy - jj | gf | thm | dgdf |
cba | df | yu | kk - ll | gf | thm | rty |
drf | sdf | yu | yy - jj | gf | thm | efewr |
kjh | ui | qw | yy - jj | gf | thm | efewr |
drf | adfg | qw | yy - jj | gf | thm | efewr |
drf | sdf | qw | yy - jj | se | thm | efewr |
drf | adfg | qw | ff- gg | se | thm | trh |
kjh | ui | qw | kk - ll | se | thm | werg |
kjh | ui | qw | yy - jj | se | thm | werg |
kjh | ui | qw | ff- gg | se | thm | werg |
kjh | ui | qw | kk - ll | se | thm | yujy |
abc | kjl | yu | ff- gg | gf | thm | wefsdf |
cba | df | yu | kk - ll | gf | thm | wefsdf |
abc | ad | yu | yy - jj | gf | thm | wefsdf |
cba | df | yu | kk - ll | gf | thm | kmkl |
drf | sdf | yu | yy - jj | gf | thm | kmkl |
kjh | ui | qw | yy - jj | gf | thm | kmkl |
drf | adfg | qw | yy - jj | gf | thm | kmkl |
drf | sdf | qw | yy - jj | se | thm | tyjyjht |
drf | adfg | qw | ff- gg | se | thm | tyjyjht |
kjh | ui | qw | kk - ll | se | thm | tyjyjht |
kjh | ui | qw | yy - jj | se | thm | tyjyjht |
Both tables are have a relationship of many to many and bidirectional. Output required (row part of matrix table):-
output | ||||||
Cat | Sub Cat | Act | concat | cust | metric | trad |
abc | kjl | yu | ff- gg | gf | thm | dgdf |
ad | yu | yy - jj | gf | thm | dgdf | |
kjl | yu | ff- gg | gf | thm | wefsdf | |
ad | yu | yy - jj | gf | thm | wefsdf | |
cba | df | yu | kk - ll | gf | thm | dgdf |
df | yu | kk - ll | gf | thm | rty | |
df | yu | kk - ll | gf | thm | wefsdf | |
df | yu | kk - ll | gf | thm | kmkl | |
drf | sdf | yu | yy - jj | gf | thm | efewr |
adfg | qw | yy - jj | gf | thm | efewr | |
sdf | qw | yy - jj | se | thm | efewr | |
adfg | qw | ff- gg | se | thm | trh | |
sdf | yu | yy - jj | gf | thm | kmkl | |
adfg | qw | yy - jj | gf | thm | kmkl | |
sdf | qw | yy - jj | se | thm | tyjyjht | |
adfg | qw | ff- gg | se | thm | tyjyjht | |
kjh | ui | qw | yy - jj | gf | thm | efewr |
ui | qw | kk - ll | se | thm | werg | |
ui | qw | yy - jj | se | thm | werg | |
ui | qw | ff- gg | se | thm | werg | |
ui | qw | kk - ll | se | thm | yujy | |
ui | qw | yy - jj | gf | thm | kmkl | |
ui | qw | kk - ll | se | thm | tyjyjht | |
ui | qw | yy - jj | se | thm | tyjyjht | |
I am not able to achieve this using dax or modelling also, and it has some numeric columns too which I have not shown in an example.
Please provide a more detailed explanation of what you are aiming to achieve. What have you tried and where are you stuck?
HI @lbendlin ,
Basically I have created a bidirectional relationship between each table, now the client want is that from table A all values should be shown irrespective of values being there in table B or not, then I changed it to unidirection relationship where Table A filters Table B, then the 1st column is from table B then next columns are from table A which do not shows the correct values, then again at last we are adding column from Table B which given an error of values cannot be shown.
I am not able to show both tables values together in unidirection relationship, and using bidirection, not all values are being shown.
Can you please confirm on what columns you are trying to create relationship between two tables?
HI @vigneshba ,
There is one common column between each table which is combination of 2 columns, which is causing many to many relationship.
and In above sample scenario it is conact column.
Thanks for the reply from@vigneshba and@lbendlin,please allow me to provide another insight:
Hi,@Jessica_17
Regarding the issue you raised, my solution is as follows:
1.Next create relationships between tables:
2.The visualization object is then modified to the following result:
3.Here's my final result, which I hope meets your requirements.
This is the more relevant approach to your needs as far as I'm concerned.
4.Of course, we still recommend using the following three options if allowed:
First, use the merge query in powerquery:
Merge queries overview - Power Query | Microsoft Learn
Second, using custom columns in powerquery:
Add a custom column in Power BI Desktop - Power BI | Microsoft Learn
Third using the lookupvalues() function in dax:
LOOKUPVALUE function (DAX) - DAX | Microsoft Learn
RELATED function (DAX) - DAX | Microsoft Learn
Please find the attached pbix relevant to the case.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
HI @v-linyulu-msft ,
Thanks for providing this solution, I think I was not able to deliver in my questions was that according to your data also, that Need to so same in Matrix table, but when I convert your data also into matrix table, it is showing values according to cross join, such as Cat "abc" do not have concat value as "kk-ll" but it is showing that value in front of "abc" Cat, even I checked the data , it does not have that data in front of Cat, so basically it should filter as what ever the associated values are in Concat column, (so only 2 values in Concat should have been shown in front of Cat "abc").
Hi,@Jessica_17
Thank you for your reply.
First of all, for your needs, I recommend using table visualizations for more convenience and intuitiveness, and matrices for aggregate hierarchical values.
Second, if you still need to display that value in the matrix, here's my solution:
1.First, you need to insert the serial number in PowerQuery to ensure that the values are not aggregated:
2.Next, copy the table and name it "head":
3.Then unpviot it:
4.Finally, get rid of duplicates and unnecessary rows:
5. Below are the measure I've created for your needs:
Measure =
SWITCH(TRUE(),
MAX('head'[Attribute])="Cat",CALCULATE(MAX('Table'[Cat]),FILTER(ALL('Table'),'Table'[Index]=MAX('Table'[Index]))),
MAX('head'[Attribute])="Act",CALCULATE(MAX('Table'[Act]),FILTER(ALL('Table'),'Table'[Index]=MAX('Table'[Index]))),
MAX('head'[Attribute])="concat",CALCULATE(MAX('Table'[concat]),FILTER(ALL('Table'),'Table'[Index]=MAX('Table'[Index]))),
MAX('head'[Attribute])="cust",CALCULATE(MAX('Table'[cust]),FILTER(ALL('Table'),'Table'[Index]=MAX('Table'[Index]))),
MAX('head'[Attribute])="metric",CALCULATE(MAX('Table'[metric]),FILTER(ALL('Table'),'Table'[Index]=MAX('Table'[Index]))),
MAX('head'[Attribute])="Sub Cat",CALCULATE(MAX('Table'[Sub Cat]),FILTER(ALL('Table'),'Table'[Index]=MAX('Table'[Index]))),
MAX('head'[Attribute])="trad",CALCULATE(MAX('Table'[trad]),FILTER(ALL('Table'),'Table'[Index]=MAX('Table'[Index])))
,FALSE())
6. Then modify the visualization settings:
7.Here's my final result, which I hope meets your requirements.
Please find the attached pbix relevant to the case.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello @v-linyulu-msft
Thanks for the solution, but I think I made it a little complex, I do require matrix only and only the concat part needs to be filtered according to previous column values as you had done in previous steps, rest are solvable as you have already completed those part.
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
114 | |
94 | |
90 | |
35 | |
35 |
User | Count |
---|---|
154 | |
100 | |
82 | |
63 | |
53 |