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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
powerbidev123
Advocate III
Advocate III

Need help for creating measure which supports AND operation

I have a table 

NameSkill
AAutomotive
AAmazon RDS
BAmazon RDS
BAutomotive
CAmazon RDS
CAutomotive
CAzure

 

I needed help with creating a measure based on below criteria:

A slicer(Skill) selection needs to be created such that upon selecting 1 or more skill the common set of Name values will be printed

a table visual.     Also the same condition I need to put it up on card visual to show the number of the unique count of Name.

 

For example : If I select 'Automotive'  and 'Amazon RDS'   from skill slicer I should get A,B,C as values since all of them have commonality of skill in them but  if I select  'Automotive'  and 'Amazon RDS' and 'Azure' then I should get no values since all 3 skills are not present for any employee at the same time

1 ACCEPTED SOLUTION

Hi @Greg_Deckler , can you please help me with the code . I tried at my end but not getting the correct outcome. This is the code :

 

SkillSelection =
VAR tmpTable1 = GENERATE(VALUES(Query1[Name]),
                         EXCEPT(
                                VALUES(Query1[Skill]),
                                CALCULATETABLE(VALUES(Query1[Skill]))))
VAR tmpTable2 = SUMMARIZE(tmpTable1,Query1[Name])
VAR tmpTable3 = EXCEPT(VALUES(Query1[Name]),tmpTable2)
RETURN CONCATENATEX(tmpTable3,Query1[Name],",")

View solution in original post

6 REPLIES 6
ThxAlot
Super User
Super User

ThxAlot_1-1717442185967.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LeanAndPractise(Everyday)


)



Greg_Deckler
Super User
Super User

@powerbidev123 I built one of those once. Not the only way to do it but one way: (1) Patient Cohort (AND Slicer) - Microsoft Fabric Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Hey @Greg_Deckler  thanks for the resource. It helped me solve the ANDing part. However I had doubt if I want to just return the names without concatenate at the end but just return only names how can I do that. Because I would be using that measure in place of my old name column

@Greg_Deckler  basically i want to use it as a column which I can use it in a table visual along with other fields

@powerbidev123 I would combine that approach with The Complex Selector. Essentially, you just need to grab the MAX value of the Name column and check to see if it is IN the table prior to CONCATENATEX. The Complex Selector - Microsoft Fabric Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler , can you please help me with the code . I tried at my end but not getting the correct outcome. This is the code :

 

SkillSelection =
VAR tmpTable1 = GENERATE(VALUES(Query1[Name]),
                         EXCEPT(
                                VALUES(Query1[Skill]),
                                CALCULATETABLE(VALUES(Query1[Skill]))))
VAR tmpTable2 = SUMMARIZE(tmpTable1,Query1[Name])
VAR tmpTable3 = EXCEPT(VALUES(Query1[Name]),tmpTable2)
RETURN CONCATENATEX(tmpTable3,Query1[Name],",")

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.