Forum Discussion
sd_parekh
3 years agoHelper I
Matrix column Subtotal
Hi all, My question is related to matrix visual. Row headers : Student name ,academic year and class name Column header: Date Values: Attendance Code Refer attached image. I want calculate co...
- 3 years ago
Hi,
looks good! Just add the zero like below:
attendance code measure = IF( HASONEVALUE(AttendanceDetails[AttendanceDate]), MIN(AttendanceStatus[AttendanceCode]), COUNTROWS( FILTER( AttendanceDetails, AttendanceDetails[AttendanceStatusId] = "2938951904584020836" ) ) + IF(COUNTROWS(AttendanceDetails) > 0, 0) ) - 3 years ago
for conditional formatting you need another measure now, sorry.
just create a measure with
condFormatMeasure = SWITCH(TRUE(), [attendence code measure] = "A", 1, [attendence code measure] = "P", 2, [attendence code measure] = "PA", 3, -1 )and use this one for the rules in conditional formatting
lukiz84
3 years agoMemorable Member
Ok, then you have to create a measure:
AttendeceCode Measure =
IF(
HASONEVALUE(table['AttendenceDate']),
MIN(table['First AttendenceCode']),
COUNTROWS(
FILTER(
table,
table['First AttendenceCode'] = 'A'
)
)
)
and use this instead of just putting "Attendance code" in your values section
sd_parekh
3 years agoHelper I
Thanks.
I wrote following measure.
attendance code measure =
IF(
HASONEVALUE(AttendanceDetails[AttendanceDate]),
MIN(AttendanceStatus[AttendanceCode]),
COUNTROWS(
FILTER(
AttendanceStatus,
AttendanceStatus[AttendanceCode] = "A"
)
)
)
It gives me following output.
In column subtotal I want count of A. Same as second matrix last column just included for your reference.
- lukiz843 years agoMemorable Member
AttendanceStatus is just the dim table right? So each of the codes is only listed once?
You need to count the rows from AttendanceDetails, not from AttendanceStatus (Because thats always 1)
- sd_parekh3 years agoHelper I
hi, Correct.
I used below code.
attendance code measure =IF(HASONEVALUE(AttendanceDetails[AttendanceDate]),MIN(AttendanceStatus[AttendanceCode]),COUNTROWS(FILTER(AttendanceDetails,AttendanceDetails[AttendanceStatusId] = "2938951904584020836")))Got following result.Thanks.
But how can we add count 0 in rest of the values in Total Column (Column subtotal)?
- lukiz843 years agoMemorable Member
Hi,
looks good! Just add the zero like below:
attendance code measure = IF( HASONEVALUE(AttendanceDetails[AttendanceDate]), MIN(AttendanceStatus[AttendanceCode]), COUNTROWS( FILTER( AttendanceDetails, AttendanceDetails[AttendanceStatusId] = "2938951904584020836" ) ) + IF(COUNTROWS(AttendanceDetails) > 0, 0) )