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.
Hello All,
I have 2 table:
1) Company
2) Employee
I have a filter of company name in page1 tab. I want to fatch the All company name based on Industry name.
one filter is there of company name which is taking by company table.
industry name i am facthing with respect company name with below measure:
Get Industry by company =
var val = SELECTEDVALUE(Companies[company name])
var industry = IF(val<>BLANK(), VALUES(CreditorWatch[ANZSIC Industry]))
return industry
here I am getting Industry name using above measure.
Now, in below image one Industry has 2 company name.
there are 2 company name in same industry "K_Finance and insurance services".
I want this 2 company name for industry "K_Finance and insurance services". in a measure.
I used below measure:
var val = SELECTEDVALUE(Companies[company name])
var industry = IF(val<>BLANK(), VALUES(employee[Industry]))
return industry
I got industry name by above measure.
after that i used below measure to get company name but i am getting single company name, but it must take 2 company name for industry "K_Finance and insurance services".
Hi @mohittimpus ,
A measure is not able to express multiple values at the same time. It is usually an aggregate value. So in this case, you can use CONCATENATEX function to combine all the values into one single string value and then display it in the visual. Try the measure below, here I use “; ” as the delimiter between values.
All Company Name =
VAR __industry = SELECTEDVALUE ( employee[Industry] )
VAR __table = FILTER ( ALL ( employee ), employee[Industry] = __industry )
VAR __table2 = SUMMARIZE ( __table, employee[Company Name] )
RETURN
CONCATENATEX ( __table2, employee[Company Name], "; " )
Moreover, if you want to display multiple company names in multiple rows of a table visual, here is another way you can take which needs a few steps to follow:
1. Create a Company List table
CompanyList = VALUES(Companies[company name])
2. Create a measure
Measure =
VAR __industry = SELECTEDVALUE ( employee[Industry] )
VAR __table = FILTER ( ALL ( employee ), employee[Industry] = __industry )
VAR __table2 = SUMMARIZE ( __table, employee[Company Name] )
RETURN
IF ( MAX ( CompanyList[Company Name] ) IN __table2, 1, 0 )
3. Put CompanyList[company name] column into the table visual and add above measure to the table’s filter.
Best Regards,
Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
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 |
---|---|
111 | |
95 | |
80 | |
68 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |