Forum Discussion
Simple Calculation required
- 7 years ago
Hi shere100
You may create a measure with COUNTX Function.For example:
Measure 2 = COUNTX ( FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Test Result] = "Pass" ), 'Table'[Test Result] ) / COUNTX ( FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Test Result] = "Not Started" ), 'Table'[Test Result] )Regards,
Hi shere100
The error is because the Table2[Value] column's type is text.Please check if this [Value] column's type is whole number.If it is not your case,please paste the simplified data sample and expected output like below article
How to Get Your Question Answered Quickly.
Regards,
Hi, I am trying to do a count on Test Result column where the total = 'pass' divide by the count of the Test Result column where the total = 'not started' to give the percentage.
- shere1007 years agoHelper II
Is the above possible to do? or do I need to create an if statement on new column if the data from test Result = 'pass' then place a 1 otherwise place 0, then to do a count on all '0' and '1'. Then create a new meaure and complete the calculation?
If the above method is correct how do I create a new column from the data set from the query? or do I create a new table and then point to the table that has the source data?
- v-cherch-msft7 years agoMicrosoft Employee
Hi shere100
You may create a measure with COUNTX Function.For example:
Measure 2 = COUNTX ( FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Test Result] = "Pass" ), 'Table'[Test Result] ) / COUNTX ( FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Test Result] = "Not Started" ), 'Table'[Test Result] )Regards,
- shere1007 years agoHelper II
Thats absolutely brilliant, that works perfectly.
Final question, if I have a visual from one query can I use that query to add an another visual i.e for the measure I have created? or do I need to create a seperate query and then insert the measure?