Happy Friday!
I am having issues with a calculated column where I have a people table and need to bring in the total passed tests for each person from another table. I’m trying to do this as a calculated column, because there are multiple types of tests and I need to run a conditional column across them to determine final results for each person.
The complication I am having is that the person table is a snapshot that has one person record per “as of date”. Because of this, I have one date table governing the people and a separate date table governing the tests (since when someone took a test is irrespective of which “as of date” someone chooses). I need a user to be able to choose the as of date for the people population, as well as the date range for when tests were completed.
This is the calculated column I’m having trouble adding to the PERSON table. I’ve tried multiple versions of this and either get ALL tests regardless of which test date is selected or in the case of the below, I get partial data (very limited number of records, all correct, but everything else blank).
I feel like I’m missing something elementary here, so any help would be massively appreciated. Thanks!
_Test_Type_1_Passes =
var _startdate = min('TEST DATE'[DATE])
var _enddate = max('TEST DATE'[DATE])
return
CALCULATE(
COUNTROWS(
FILTER('Test Data',
'Test Data'[Result]="Pass" &&
'Test Data'[Type]= "1" &&
selectedvalue('Test Data'[Date]) >= _startdate &&
selectedvalue('Test Data'[Date]) <= _enddate
)))
I have a feeling it's due to how my model is set up, but I hesitate changing it if possible, since this is part of a much wider report. Here's a simplified model:
Expected result in person table:
Person | Test_Type_1_Passes | Test_Type_2_Passes | Test_Type_3_Passes |
John | 3 | 0 | 1 |
Sally | 5 | 2 | 1 |
Anders | 1 | 0 | 0 |
Solved! Go to Solution.
Update: I've gotten this to work by abandoning the calculated column and just using a measure. I feel like this is usually the answer every time I have a problem with a calculated column.
Update: I've gotten this to work by abandoning the calculated column and just using a measure. I feel like this is usually the answer every time I have a problem with a calculated column.
Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!
User | Count |
---|---|
108 | |
75 | |
66 | |
50 | |
48 |
User | Count |
---|---|
164 | |
87 | |
77 | |
70 | |
67 |