Forum Discussion
samcaicn
9 years agoFrequent Visitor
want sorting by Percentage
Data column”SEX“ is ”0“ and ”1“; Axis is ”REGION“, Value is ”SEX“ percentage; can't sorting by male(0) percentage, ps help,thanks
You can use the CALCULATE function to count filtered values.
Male %age = CALCULATE(Count([sex]),[sex] = "Male") / Count([sex])
8 Replies
- ceebu
Advocate I
Have you tried the latest version of PBI Desktop ? see below:
- samcaicnFrequent VisitorMale percentage = DIVIDE(COUNTROWS('JK_STUDENT_BASE'[MALE]),COUNTROWS('JK_STUDENT_BASE'[SEX]))
- samcaicnFrequent Visitornewest, only can sorting by ”SEX“ counting, cant by "SEX"(0)’s percentage
- samcaicnFrequent VisitorMALE = IF(---- CONDITION ---- JK_STUDENT_BASE[SEX] = 1, ---- THEN ---- JK_STUDENT_BASE[SEX], ---- ELSE ---- BLANK() )
- v-huizhn-msft
Microsoft Employee
Hi samcaicn,
The MALE is a calculated column? The synax of COUNTROWS function is COUNTROWS(<table>). Why you use column rather than table? Why you use Could you please share the complete DAX and your sample data for further analysis? So we can post the solution which is close your requirement. It's hard to reproduce your scenario. Thanks for understanding.
Best Regards,
Angelia