Forum Discussion
Dax Calculation needed for matrix visual
- 4 years ago
I prefer to work with numbers, so, this might look a bit too complicated. Just took the following sample data:
From your logic, a would be staff, b,c,d wouldn't.
First: Transform these yes and no into numbers no = 0 and yes = 1, using calculated columns:
test1passint = IF(test1pass = "yes", 1, 0)
test2passint = IF(test2pass = "yes", 1, 0)
This gives this result:Now you can transform text into sums, define the following measure:
isStaff = IF(SUMX(table, test1passint) = 1 && SUMX(table, test2passint) = 1, 1, 0)
Now placing all persons in a table and putting isStaff as a filter with 1 as its value, returns just a: - 4 years ago
Define the following measure (I use __ to indicate I use variables in measures)
numbersstaff =
VAR __stafftable = SUMMARIZE(
table,
person,
"member of staff",
isStaff (the measure from above)
)
RETURN SUMX(__stafftable, __stafftable[member of staff])
This is like pregrouping the data for further calculations. Really helpful in case you wanna work just with raw data.
I prefer to work with numbers, so, this might look a bit too complicated. Just took the following sample data:
From your logic, a would be staff, b,c,d wouldn't.
First: Transform these yes and no into numbers no = 0 and yes = 1, using calculated columns:
test1passint = IF(test1pass = "yes", 1, 0)
test2passint = IF(test2pass = "yes", 1, 0)
This gives this result:
Now you can transform text into sums, define the following measure:
isStaff = IF(SUMX(table, test1passint) = 1 && SUMX(table, test2passint) = 1, 1, 0)
Now placing all persons in a table and putting isStaff as a filter with 1 as its value, returns just a: