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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
Sri_phani
Helper III
Helper III

Quartile calculation based on filters applied on page

Hello, I have a dataset that has Agents and their Metric scores for which I have to calculate Quartile. Q1 is the top quartile and Q4 is the bottom Quartile. 

 

Sample : 

Sri_phani_1-1712994382775.png

 

But when I use the below function, it doesn't give the accurate Quartile. I am assuming it's because it's calculating the Quartile based on entire data set. I have multiple filters like Months, Dates, Department etc. So basically, my table should calculate the Quartile based on agents visible on table by applying all filters applicable on the visual. 

=
VAR AgentScore = [Customer Resolve %]
VAR FilteredData = ALL(Agent_mapping[Agent ID])
RETURN
IF(
          AgentScore <= PERCENTILEX.INC(FilteredData, [Customer Resolve %], 0.25), "Q1",
IF(
          AgentScore <= PERCENTILEX.INC(FilteredData, [Customer Resolve %], 0.50), "Q2",
IF(
           AgentScore <= PERCENTILEX.INC(FilteredData, [Customer Resolve %], 0.75), "Q3", "Q4"
)

)
)

 

I checked the forum for help, but couldn't find the help I need. Kindly help me with this. 

1 ACCEPTED SOLUTION

@Sri_phani 
I think there is no issue with the filters, If my understanding about your requirement is right then your formula is incorrect

Quartile = 

VAR AgentScore = [Customer Resolve %]
VAR FilteredData = ALLSELECTED(data[Agent ID])

return SWITCH(
    TRUE(),
    AgentScore >= PERCENTILEX.INC(FilteredData, [Customer Resolve %], 0.75), "Q1", 
    AgentScore >= PERCENTILEX.INC(FilteredData, [Customer Resolve %], 0.25), "Q2", 
    AgentScore >= PERCENTILEX.INC(FilteredData, [Customer Resolve %], 0.25), "Q3", 
    "Q4"
) 

 

Please find the pbix file:here

 


If the post helps please give a thumbs up


If it solves your issue, please accept it as the solution to help the other members find it more quickly.


Tharun

 

View solution in original post

4 REPLIES 4
ThxAlot
Super User
Super User

ThxAlot_0-1713083411731.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



tharunkumarRTK
Super User
Super User

ALL function will not consider the filters within the visual and also the filters from other visuals. Based on what I understand, you should use ALLSELECTED instead of ALL. If you need any help further then I would request you to share the pbix with sample data and expected output.

 


If the post helps please give a thumbs up


If it solves your issue, please accept it as the solution to help the other members find it more quickly.


Tharun

 

Hi @tharunkumarRTK thank you for responding. I already tried ALLSELECTED. But it is not working with multiple slicers. I am attaching the sample PBI file. It only has two slicers. just to let you know, my data has Team leader, Department, Month as slicers. 

 

What I am trying to create is, the Quartile should be calculated based on the agent scores available on Visuals based on the slicers we select. 

 

Sample PBIX file

@Sri_phani 
I think there is no issue with the filters, If my understanding about your requirement is right then your formula is incorrect

Quartile = 

VAR AgentScore = [Customer Resolve %]
VAR FilteredData = ALLSELECTED(data[Agent ID])

return SWITCH(
    TRUE(),
    AgentScore >= PERCENTILEX.INC(FilteredData, [Customer Resolve %], 0.75), "Q1", 
    AgentScore >= PERCENTILEX.INC(FilteredData, [Customer Resolve %], 0.25), "Q2", 
    AgentScore >= PERCENTILEX.INC(FilteredData, [Customer Resolve %], 0.25), "Q3", 
    "Q4"
) 

 

Please find the pbix file:here

 


If the post helps please give a thumbs up


If it solves your issue, please accept it as the solution to help the other members find it more quickly.


Tharun

 

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.