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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
prateekraina
Memorable Member
Memorable Member

Forming AND condition between slicers of connection less tables

Hi Everyone,

 

I have a very interesting scenario and would appreciate your help in resolving this.

I have a sample data which looks like below:

 

Skill NameCompetency CodeName
English7P1
Data Developer4P1
SQL Server2P1
C Sharp1P1
English7P2
English7P3
Data Developer4P3
SQL Server2P3
C Sharp2P3

 

Problem Statement: I need to put 3 slicers on the report namely Primary Skill, Secondary Skill and Other based out of [Skill Name] column in above data.
Each of the slicer will have an asscoated Competency Code Range. Primary is 5-7, Secondary is 3-4 and Other is 0-2.

A1.PNG

So, when I choose English in Primary Skill slicer, Data Developer in Secondary and SQL Server in Other skills slicer, I should see the Names of Person who satisfy all these 3 conditions i.e We need to find a person who has all these 3 skills.

Expected Output:

NameSkill
P1English
P1Data Developer
P1SQL Server
P3English
P3Data Developer
P3SQL Server

 

Solution Tried:

I have created 3 connection less tables for Primary, Secondary and Other Skills and Competecy.
Then I have tried to identify the selected Skill and Competency Code thorugh below measure for Primary, Secondary and Other slicers and marked the grid rows as 1/0.

IF(
    SELECTEDVALUE(Data[Skill Name]) = [Primary Skill]
    && MAX(Data[Competency Code]) >= [Primary Min Competency Code]
    && MAX(Data[Competency Code]) <= [Primary Max Competency Code]
    ,1
    ,0
)

I am not however able to club the result together. Its doing kind of OR between them.


It would be greatly appreciated if someone could try this out. This has driven me crazy I should mention that.

-Prateek Raina

1 ACCEPTED SOLUTION
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @prateekraina 

You may create primary,secondary,other measures with the IF condition.Then get the output as below:

Primary = IF(MAX(Data[Skill Name])=MAX(Primary[Primary Skill]) &&MAX(Data[Competency Code])>=MAX(Primary[Competency code min])&&MAX(Data[Competency Code])<=MAX(Primary[Competency code max]),1,0)
Output = 
VAR a =
    CALCULATETABLE ( VALUES ( Data[Name] ), FILTER ( ALL ( Data ), [Primary] = 1 ) )
VAR b =
    CALCULATETABLE ( VALUES ( Data[Name] ), FILTER ( ALL ( Data ), [Second] = 1 ) )
VAR c =
    CALCULATETABLE ( VALUES ( Data[Name] ), FILTER ( ALL ( Data ), [Other] = 1 ) )
RETURN
    IF (
        AND (
            MAX ( Data[Name] ) IN a
                && MAX ( Data[Name] ) IN b
                && MAX ( Data[Name] ) IN c,
            [Primary] = 1
                || [Second] = 1
                || [Other] = 1
        ),
        1
    )

1.png

Regards, 

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @prateekraina 

You may create primary,secondary,other measures with the IF condition.Then get the output as below:

Primary = IF(MAX(Data[Skill Name])=MAX(Primary[Primary Skill]) &&MAX(Data[Competency Code])>=MAX(Primary[Competency code min])&&MAX(Data[Competency Code])<=MAX(Primary[Competency code max]),1,0)
Output = 
VAR a =
    CALCULATETABLE ( VALUES ( Data[Name] ), FILTER ( ALL ( Data ), [Primary] = 1 ) )
VAR b =
    CALCULATETABLE ( VALUES ( Data[Name] ), FILTER ( ALL ( Data ), [Second] = 1 ) )
VAR c =
    CALCULATETABLE ( VALUES ( Data[Name] ), FILTER ( ALL ( Data ), [Other] = 1 ) )
RETURN
    IF (
        AND (
            MAX ( Data[Name] ) IN a
                && MAX ( Data[Name] ) IN b
                && MAX ( Data[Name] ) IN c,
            [Primary] = 1
                || [Second] = 1
                || [Other] = 1
        ),
        1
    )

1.png

Regards, 

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-cherch-msft  Thank you for the help. This was perfect.

 

-Prateek Raina

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

August Carousel

Fabric Community Update - August 2024

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