Forum Discussion
govi
Helper II
2 years agoCalculate result from two records
Hi, I am stuck.... I have a query with these records: Users are asked questions during the day. One of the questions "Have you taken your study medication TODAY?" is asked at 9:00 in the mornin...
- 2 years ago
govi
I have created a column to calculate the outcome, let me know how the percentage should b calucated if you need help.Outcome = VAR __userid = Table1[userld] VAR __questionday = Table1[question Day] VAR __T = CALCULATETABLE( VALUES( Table1[Answer]), Table1[userld] = __userid, Table1[question Day] = __questionday, REMOVEFILTERS() ) VAR __Y = "Yes" VAR __N = "No" VAR __NA = "n/a" VAR __NotA = "not answered" VAR __RESULT = SWITCH( TRUE(), __Y in __T , __Y, NOT __Y in __T && __N IN __T , __N, COUNTROWS(__T) = 1 && __NotA IN __T , __NotA ) RETURN __RESULT
Fowmy
Super User
2 years agogovi
I have created a column to calculate the outcome, let me know how the percentage should b calucated if you need help.
Outcome =
VAR __userid = Table1[userld]
VAR __questionday = Table1[question Day]
VAR __T = CALCULATETABLE( VALUES( Table1[Answer]), Table1[userld] = __userid, Table1[question Day] = __questionday, REMOVEFILTERS() )
VAR __Y = "Yes"
VAR __N = "No"
VAR __NA = "n/a"
VAR __NotA = "not answered"
VAR __RESULT =
SWITCH(
TRUE(),
__Y in __T , __Y,
NOT __Y in __T && __N IN __T , __N,
COUNTROWS(__T) = 1 && __NotA IN __T , __NotA
)
RETURN
__RESULT