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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Kaii
Helper I
Helper I

Controlling filters in percentile calculation

I have this measure, I need the percentile lines to stay constant even if we select another "subject", so we can see if a subject falls above/below certain constant percentile values.

Measure = 
VAR _ATABLE = 
    SUMMARIZE(
        ALL('Table'[Company]),
        'Table'[Company],
        "VALUE", SUM('Table'[VALUE])
    )
RETURN
CALCULATE(
    PERCENTILEX.INC(_ATABLE, [VALUE], 0.5)
)

 

I am not sure which part I am doing wrong, this measure doesnt work properly with the "Type" filter which within the same table

Kaii_0-1718411298944.png

 

as you can see when " Bird" Been selected. the precentile measure return as "Blank" . 
This is how my table looks like 

Kaii_1-1718411298945.png

 

 


Could anyone help me figure out why?
Thank you very much 

1 ACCEPTED SOLUTION

Hi @Kaii ,

The Table data is shown below:

vzhouwenmsft_0-1718677521383.png

 

Please follow these steps:

1.Use the following DAX expression to create a table

 

Table 2 = SUMMARIZE('Table',[subject],"VALUE",SUM('Table'[VALUE]))

 

2.Use the following DAX expression to create a measure

 

Measure = 
IF(NOT ISFILTERED('Table'[Type]),
PERCENTILEX.INC('Table 2',[VALUE],0.5),
CALCULATE(PERCENTILEX.INC('Table',[VALUE],0.5),ALL('Table'[subject])))

 

3.Final output

vzhouwenmsft_3-1718677695690.png

 

vzhouwenmsft_2-1718677599710.png

Best Regards,
Wenbin Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
v-zhouwen-msft
Community Support
Community Support

Hi @Dangar332 ,thanks for your quick reply, I will add more.

Hi @Kaii ,

The Table data is shown below:

vzhouwenmsft_0-1718592983653.png

Use the following DAX expression to create a measure

Measure = CALCULATE(PERCENTILEX.INC('Table',[VALUE],0.5),ALL('Table'[subject]))
_Value = SUM('Table'[VALUE])

Final output

vzhouwenmsft_1-1718593148865.png

vzhouwenmsft_2-1718593160934.png


Best Regards,
Wenbin Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hey , Thanks for the reply, 
Your measure works almost perfectly.....
it works very well when one Type has been selected, but if you didn't select any type. the numbers are not right.
For example, 

Kaii_0-1718652812349.png

I did not select anything, the 50%th line should return as (20+23)/2 =21.5 but it returns as 15 which is the the 50%th number without aggregation. 

Kaii_1-1718653002772.png

Do you know any way we can fix this?
Thank you so Much

Hi @Kaii ,

The Table data is shown below:

vzhouwenmsft_0-1718677521383.png

 

Please follow these steps:

1.Use the following DAX expression to create a table

 

Table 2 = SUMMARIZE('Table',[subject],"VALUE",SUM('Table'[VALUE]))

 

2.Use the following DAX expression to create a measure

 

Measure = 
IF(NOT ISFILTERED('Table'[Type]),
PERCENTILEX.INC('Table 2',[VALUE],0.5),
CALCULATE(PERCENTILEX.INC('Table',[VALUE],0.5),ALL('Table'[subject])))

 

3.Final output

vzhouwenmsft_3-1718677695690.png

 

vzhouwenmsft_2-1718677599710.png

Best Regards,
Wenbin Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Dangar332
Super User
Super User

Hi, @Kaii 

I don't know i fully getting you or not

But try to add 
Filter(All(Table[type]),true())  TO your calculate part

 

Measure = 
VAR _ATABLE = 
    SUMMARIZE(
        ALL('Table'[Company]),
        'Table'[Company],
        "VALUE", SUM('Table'[VALUE])
    )
RETURN
CALCULATE(
    PERCENTILEX.INC(_ATABLE, [VALUE], 0.5),
    Filter(All(Table[type]),true())
)

 


Best Regards,
Dangar

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hey, the measure doesn't work😥
Whta im look for is ignore the "subject" filter but still filter on "Type". 

Thanks 

Hi, @Kaii 

 

Measure = 

VAR _ATABLE = 

    SUMMARIZE(

        ALL('Table'[Company]),

        'Table'[Company],

        "VALUE", SUM('Table'[VALUE])

    )

RETURN

CALCULATE(

    PERCENTILEX.INC(_ATABLE, [VALUE], 0.5),

    Filter(All(Table[Subject]),true())

)

 

 

Hey, thanks for the reply. But it still not working properly,
when I select "Bird" the measure should return as "4" but it returns as blank.

Kaii_0-1718519400973.png

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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