cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
scaast Frequent Visitor
Frequent Visitor

Dual Filters Problem

Hello,  I have a table with Date, Employee Name, Score, and a Survey column.   I want to display the bottom ten Employees that received at least 10 surveys in a selected time period.   The Survey column is always 1...ie Alvin received a second survey on 8/7, and the survey column still reflects a one.  I'm a newb with DAX, and I've not been able to come up with the right syntax to make it happen.  All help is appreciated.  

 

EXAMPLE:

 

DateEmployee NameScoreSurvey
8/3/2017Alvin41
8/3/2017Theodore101
8/5/2017Simon71
8/7/2017Alvin81
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support Team
Community Support Team

Re: Dual Filters Problem

Hi @scaast,

 

In my test, the table visual displayed the bottom 2 Employees that received at least 3 surveys in a selected time period.

 

Please refer to measures:

Survey =
CALCULATE (
    COUNT ( 'Employee Survery'[Employee Name] ),
    FILTER (
        ALLSELECTED ( 'Employee Survery' ),
        'Employee Survery'[Employee Name]
            = SELECTEDVALUE ( 'Employee Survery'[Employee Name] )
    )
)

Rank =
IF (
    'Employee Survery'[Survey] >= 3,
    RANKX ( ALLSELECTED ( 'Employee Survery' ), [Survey],, DESC, DENSE ),
    BLANK ()
)

flag1 = MAXX(ALLSELECTED('Employee Survery'),[Rank])
flag2 = IF([Rank]>=[flag1]-1&&[Rank]<>BLANK(),1,0)

Add measure [flag2] to visual level filter, and set its value to 1.

3.PNG

1.PNG

2.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 REPLIES 3
Seward12533 New Contributor
New Contributor

Re: Dual Filters Problem

Need give us a bit more to work with. Can you share how your table is built, what your data model looks like and any measures.  If your using filters in your measure for Survey count and score you probably don't need them and should let PowerBI imply the filter context as it builds you table. I woudl think your measures shoudl simply be

 

Score = AVERAGE(table[score])

Survey = DISTINCTCOUNT(table[surveyid])

 

If you then build a Matrix visual with Date, Employee Name and the measures it will display one line per employee wiht average score and # of surveys. if you want one row per survey include Survey ID in the rows. 

 

Tips: create a survey rank measure using RANKX with the decending option to identify the bottom n and then filter you visual with that measure. 

 

Highlighted
Community Support Team
Community Support Team

Re: Dual Filters Problem

Hi @scaast,

 

In my test, the table visual displayed the bottom 2 Employees that received at least 3 surveys in a selected time period.

 

Please refer to measures:

Survey =
CALCULATE (
    COUNT ( 'Employee Survery'[Employee Name] ),
    FILTER (
        ALLSELECTED ( 'Employee Survery' ),
        'Employee Survery'[Employee Name]
            = SELECTEDVALUE ( 'Employee Survery'[Employee Name] )
    )
)

Rank =
IF (
    'Employee Survery'[Survey] >= 3,
    RANKX ( ALLSELECTED ( 'Employee Survery' ), [Survey],, DESC, DENSE ),
    BLANK ()
)

flag1 = MAXX(ALLSELECTED('Employee Survery'),[Rank])
flag2 = IF([Rank]>=[flag1]-1&&[Rank]<>BLANK(),1,0)

Add measure [flag2] to visual level filter, and set its value to 1.

3.PNG

1.PNG

2.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
scaast Frequent Visitor
Frequent Visitor

Re: Dual Filters Problem

Very helpful.   Thank you!