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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.