Forum Discussion
Database design for comparing rows
- 6 years ago
Hi Benjamin_Eureka,
Is the output in your data your expected output? But as parry2k said, the data you provided lack candidate column. Would you please check for it?
If you want to filter out candidate that pass both Exam A and Exam B, please refer to the measure below:
Measure = VAR A = CALCULATE ( MAX ( 'Table'[result] ), ALLEXCEPT ( 'Table', 'Table'[candidate] ), 'Table'[exam] = "ExamA" ) VAR B = CALCULATE ( MAX ( 'Table'[result] ), ALLEXCEPT ( 'Table', 'Table'[candidate] ), 'Table'[exam] = "ExamB" ) RETURN IF ( A = "Yes" && B = "Yes", 1, 0 )If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
I'm sorry. Another try. I have updated the file to match the example I gave. Now you see a simple output table with dummy numbers as well as an example of the input table. The question I have is:
How can I check if candidates who took Exam A had a higher grade for Exam B than the people who did not take Exam A before?
Thanks for your efforts
The file: https://eurekagroep-my.sharepoint.com/:x:/g/personal/benjamin_eureka-groep_nl/EQ6bgdyF6elNrkopSZ5SAOUB4KgsamxGPHbLe99FjGKPIg?e=rbqXqd
Benjamin_Eureka Maybe I'm not reading it correctly, there is no candidate in your sample data who took exam A and also exam b so how we can answer the 1st question?
- Benjamin_Eureka6 years agoFrequent Visitor
Like I said: it's dummy data. I cannot share the real data due to company limitations. But that's besides the point. The data itself doesn't matter. The question is how I can find out if a candidate who passed Exam B already passed Exam A. Or in a more abstract way: how can I find out if a certain entry is available in slightly different form anywehere else in the database. I am looking for the abstraction of the solution; the file provided is purely for clarification purposes.
- parry2k6 years agoSuper User
Benjamin_Eureka understood it is fake data but it has to make sense so that I can test the solution at my end before giving you something which doesn't make sense. I am a bit surprised to see the sample data which is not at all useable to test the solution. I hope someone else can help here. I don't like to provide a solution that I cannot even test and see working. I surely know what I need to do but I need to test it. Good luck!
- v-deddai1-msft6 years agoCommunity Support
Hi Benjamin_Eureka,
Is the output in your data your expected output? But as parry2k said, the data you provided lack candidate column. Would you please check for it?
If you want to filter out candidate that pass both Exam A and Exam B, please refer to the measure below:
Measure = VAR A = CALCULATE ( MAX ( 'Table'[result] ), ALLEXCEPT ( 'Table', 'Table'[candidate] ), 'Table'[exam] = "ExamA" ) VAR B = CALCULATE ( MAX ( 'Table'[result] ), ALLEXCEPT ( 'Table', 'Table'[candidate] ), 'Table'[exam] = "ExamB" ) RETURN IF ( A = "Yes" && B = "Yes", 1, 0 )If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
- Benjamin_Eureka6 years agoFrequent Visitor
v-deddai1-msft Thnx for your reply. The candidate column is not lacking, it is represented by the first column: Candidate Id. This number is the same as a unique candidate name; every candidate has it's own number.
Thank you for the measure! One thing though, is that it doesn't make the distinction between candidates who first took Exam A and then took Exam B vs. the candidates who took Exam B first before Exam A. But it does definitely point me in the right direction. Thanks for your effort.
- v-deddai1-msft6 years agoCommunity Support
You need to add a comparison of two Exams' time to the if criteria, which is similar to my measure above
- Benjamin_Eureka6 years agoFrequent Visitor
Ah of course. Using variables is still new for me; sounds like a learning opportunity. I have enough to play around. Thanks a lot!