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
JMG241188
Frequent Visitor

Need to remove values from dynamic table in DAX percentile Calc

Hey,

 

I have a fomula that is calcualting the percentile of a value, however, I need to remove any row that is equal to "0" as these results should not get a percentile rank and are skewing the rating of the other values.

 

Any help would be greatly appreciated, I'm guessing there needs to be another filter where the Employees[Total Handled Rate 2022] <> 0 but can't seem to figure it out.

 

Formula is below;

 

Total Handled Rate 2022 Percentile =
VAR Adj2022 =
    MIN(Employees[Total Handled Rate 2022])
RETURN
    IF(
        HASONEVALUE(Employees[Code]),
        COALESCE(
            DIVIDE(

                CALCULATE(
                    COUNTROWS(Employees),
                    FILTER(
                        ALLEXCEPT(Employees,Employees[Department]),
                        Employees[Total Handled Rate 2022] > Adj2022
                    )
                ),

                CALCULATE(
                    COUNTROWS(Employees),
                    ALLEXCEPT(Employees,Employees[Department])
                )
            ),
            0
        )
    )
 
Thanks
1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @JMG241188 

try like:

Total Handled Rate 2022 Percentile =
VAR Adj2022 =
    MIN(Employees[Total Handled Rate 2022])
RETURN
    IF(
        HASONEVALUE(Employees[Code]),
        COALESCE(
            DIVIDE(
 
                CALCULATE(
                    COUNTROWS(Employees),
                    FILTER(
                        ALLEXCEPT(Employees,Employees[Department]),
                        Employees[Total Handled Rate 2022] > Adj2022&&Employees[Total Handled Rate 2022] <> 0
                    ),
                ),
 
                CALCULATE(
                    COUNTROWS(Employees),
                    ALLEXCEPT(Employees,Employees[Department]),
Employees[Total Handled Rate 2022] <> 0
                )
            ),
            0
        )
    )

View solution in original post

3 REPLIES 3
FreemanZ
Super User
Super User

hi @JMG241188 

try like:

Total Handled Rate 2022 Percentile =
VAR Adj2022 =
    MIN(Employees[Total Handled Rate 2022])
RETURN
    IF(
        HASONEVALUE(Employees[Code]),
        COALESCE(
            DIVIDE(
 
                CALCULATE(
                    COUNTROWS(Employees),
                    FILTER(
                        ALLEXCEPT(Employees,Employees[Department]),
                        Employees[Total Handled Rate 2022] > Adj2022&&Employees[Total Handled Rate 2022] <> 0
                    ),
                ),
 
                CALCULATE(
                    COUNTROWS(Employees),
                    ALLEXCEPT(Employees,Employees[Department]),
Employees[Total Handled Rate 2022] <> 0
                )
            ),
            0
        )
    )

Hey, thanks for the response, I'm getting an error of;

 

"Argument '3' in CALCULATE function is required.

just had to remove the comma after the bracket, thanks for your help

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.

Top Solution Authors