Forum Discussion
Dynamic measure based on a date slicer
Hi everyone !
I am new to power bi and started using it very recently. Could someone help me ? I have a table which records the date-wise attempts of the tests taken and their status. There are no restrictions on the no. of attempts for the tests. I am struggling to get the solution in a scenario, that requires the no. of unique students who have taken the tests during a specific date periods (Date is used as slicer) and passed. The table looks like this:
| Name | Lesson_ID | Test Attempted Date | Status |
| Anil | L1 | 01-01-2021 | fail |
| Ramu | L2 | 01-01-2021 | pass |
| Anil | L1 | 02-01-2021 | pass |
| Kris | L1 | 02-01-2021 | pass |
| Siva | L1 | 02-01-2021 | fail |
| Kris | L2 | 02-01-2021 | pass |
| Anil | L2 | 03-01-2021 | pass |
| Ramu | L1 | 03-01-2021 | fail |
| Siva | L2 | 03-01-2021 | pass |
| Kris | L1 | 03-01-2021 | pass |
| Kris | L2 | 04-01-2021 | fail |
| Siva | L1 | 04-01-2021 | pass |
For example, If I select Date range from 01.01.2021 to 02.01.2021, the result should be like :
| Name | L1 | L2 |
| Anil | 1 | 0 |
| Ramu | 0 | 1 |
| Kris | 1 | 1 |
| Siva | 0 | 0 |
And, If I select Date range from 01.01.2021 to 04.01.2021, the result should be like:
| Name | L1 | L2 |
| Anil | 1 | 1 |
| Ramu | 0 | 1 |
| Kris | 1 | 1 |
| Siva | 1 | 1 |
Thanks in advance.
Krish35
Create a measure as shown below, insert a matrix visual and plot the data as follows :Result = CALCULATE( DISTINCTCOUNT(T4[Name]), T4[Status]="Pass" )
5 Replies
- Krish35Frequent Visitor
Thank you Fowmy. It worked for me. Is it possible to show a measure or calculated column for the no. of students(distinctcount) who have passed any one or any two or any three...any ten tests from a list of 10 test IDs i.e., L1,L2,L3..upto L10 (used as slicer), for a date period(date slicer). Student passing same test twice or more to be treated as one.
Thanks again.
- vanessafvg
Community Champion
do you need a count of the tests or of the student? I would think that measure should work if you just want to count the student for any pass that has been had
- vanessafvg
Community Champion
- Krish35Frequent Visitor
Thank you..but the student 'Kris' showing twice under test 'L1' for the date period 01.01.2021 to 04.01.2021..it should show as only 1.