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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
MarjanZamani
Regular Visitor

How to detect and treat outliers in power query?

I have a dataset that includes members' ages. The age column has outlier values such as 0 and 145. Before creating the data model and visuals, I want to detect outliers in Power Query and use quantile based flooring and capping method to treat and replace them. I appreciate your help in advance. 



5 ACCEPTED SOLUTIONS
MFelix
Super User
Super User

Hi @MarjanZamani 

 

Check if this post can help you achieve what you need.

 

https://www.linkedin.com/pulse/power-bi-briefing-mpower-query-outlier-detection-time-chatterjee/


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

v-kpoloju-msft
Community Support
Community Support

Hi @MarjanZamani,

Thank you for reaching out to the Microsoft fabric community forum. Also thanks to @MFelix , for his insights on this thread. I reproduced the scenario, and it worked on my end. I used M code and successfully implemented it. Used line chart.

Open a blank query; it should appear like this. Then, copy and paste the M code into the advanced editor:

vkpolojumsft_3-1750933561362.pngvkpolojumsft_4-1750933611135.png

M Code:

let

    Source = Table.FromRows({

        {1, 25},

        {2, 32},

        {3, 0},

        {4, 28},

        {5, 35},

        {6, 40},

        {7, 145},

        {8, 22},

        {9, 90},

        {10, 18},

        {11, 55},

        {12, 60},

        {13, 75},

        {14, 20},

        {15, 33}

    }, {"MemberID", "Age"}),



    AddFinal = Table.AddColumn(Source, "Final_Age", each

        if [Age] < 20 then 20

        else if [Age] > 75 then 75

        else [Age])

in

    AddFinal

 

outcome:
vkpolojumsft_5-1750933699889.png


I am also including .pbix file for your better understanding, please have a look into it:

If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.

Thank you for using Microsoft Community Forum.






View solution in original post

Hi @MarjanZamani,

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

View solution in original post

Hi @MarjanZamani,

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.

View solution in original post

Hi @MarjanZamani,

I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further.
Thank you.

View solution in original post

5 REPLIES 5
v-kpoloju-msft
Community Support
Community Support

Hi @MarjanZamani,

Thank you for reaching out to the Microsoft fabric community forum. Also thanks to @MFelix , for his insights on this thread. I reproduced the scenario, and it worked on my end. I used M code and successfully implemented it. Used line chart.

Open a blank query; it should appear like this. Then, copy and paste the M code into the advanced editor:

vkpolojumsft_3-1750933561362.pngvkpolojumsft_4-1750933611135.png

M Code:

let

    Source = Table.FromRows({

        {1, 25},

        {2, 32},

        {3, 0},

        {4, 28},

        {5, 35},

        {6, 40},

        {7, 145},

        {8, 22},

        {9, 90},

        {10, 18},

        {11, 55},

        {12, 60},

        {13, 75},

        {14, 20},

        {15, 33}

    }, {"MemberID", "Age"}),



    AddFinal = Table.AddColumn(Source, "Final_Age", each

        if [Age] < 20 then 20

        else if [Age] > 75 then 75

        else [Age])

in

    AddFinal

 

outcome:
vkpolojumsft_5-1750933699889.png


I am also including .pbix file for your better understanding, please have a look into it:

If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.

Thank you for using Microsoft Community Forum.






Hi @MarjanZamani,

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

Hi @MarjanZamani,

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.

Hi @MarjanZamani,

I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further.
Thank you.

MFelix
Super User
Super User

Hi @MarjanZamani 

 

Check if this post can help you achieve what you need.

 

https://www.linkedin.com/pulse/power-bi-briefing-mpower-query-outlier-detection-time-chatterjee/


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

Top Solution Authors