Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
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:
Date | Employee Name | Score | Survey |
8/3/2017 | Alvin | 4 | 1 |
8/3/2017 | Theodore | 10 | 1 |
8/5/2017 | Simon | 7 | 1 |
8/7/2017 | Alvin | 8 | 1 |
Solved! Go to Solution.
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.
Best regards,
Yuliana Gu
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.
Best regards,
Yuliana Gu
Very helpful. Thank you!
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.
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
113 | |
109 | |
107 | |
92 | |
67 |
User | Count |
---|---|
161 | |
129 | |
129 | |
92 | |
91 |