mercredi 1 juillet 2020

Switch( True(), expression with measures used in result

I have a list of survey responses that have three different multiple-choice response groupings,

Survey Response Grouping = {Group1, Group2, Group3}

Survey Response = { Group1 = {Strongly Agree, Agree, Neutral, Disagree, Strongly Disagree};

Group2 = {One of the Best, Above Average, Average, Below Average, One of the Worst};

Group3 = {Greater than or equal to 10, 4-10, 2-4, 1-2, Less than or equal to 1}}

I am trying to create a measure in DAX (Excel) to calculate the percent of responses by multiple-choice grouping but keep getting an error due to aggregation.

Here is one of my attempted measures with switch( true():

% of Responses:=SWITCH( TRUE(), 'Manager'[Survey Response Group]="Group1", COUNTAX('Manager', 'Manager'[Survey Response])/[var Mgr Group1], 'Manager'[Survey Response Group]="Group2", COUNTAX('Manager', 'Manager'[Survey Response])/[var Mgr Group2], 'Manager'[Survey Response Group]="Group3", COUNTAX('Manager', 'Manager'[Survey Response])/[var Mgr Group3])

where var Mgr Group1 = var Mgr Group1:=CALCULATE( COUNTAX( RELATEDTABLE('Manager Group1'), 'Manager Group1'[Survey Response Group]))

var Mgr Group2 = var Mgr Group2:=CALCULATE( COUNTAX( RELATEDTABLE('Manager Group2'), 'Manager Group2'[Survey Response Group]))

var Mgr Group3 = var Mgr Group3:=CALCULATE( COUNTAX( RELATEDTABLE('Manager Group3'), 'Manager Group3'[Survey Response Group]))

Can anyone help me with this?

Thanks

Aucun commentaire:

Enregistrer un commentaire