Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
samcaicn
Frequent 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
1 ACCEPTED SOLUTION

You can use the CALCULATE function to count filtered values.

 

Male %age = CALCULATE(Count([sex]),[sex] = "Male") / Count([sex])

View solution in original post

8 REPLIES 8
ceebu
Advocate I
Advocate I

Have you tried the latest version of PBI Desktop ? see below:

Screenshot - 4_7_2017 , 1_38_26 PM.png

 

 

 

 

MALE = IF(---- CONDITION ---- JK_STUDENT_BASE[SEX] = 1, ---- THEN ---- JK_STUDENT_BASE[SEX], ---- ELSE ---- BLANK() )

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

My aim sorting by [MALE], not sorting by count of [SEX]

You can use the CALCULATE function to count filtered values.

 

Male %age = CALCULATE(Count([sex]),[sex] = "Male") / Count([sex])

Thanks,your‘re right,so it show errors; ALL DAX is this two; the sample data is [SEX] 1 1 1 0 1 1..... Thanks for your help

Male percentage = DIVIDE(COUNTROWS('JK_STUDENT_BASE'[MALE]),COUNTROWS('JK_STUDENT_BASE'[SEX]))

newest, only can sorting by ”SEX“ counting, cant by "SEX"(0)’s percentage

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors