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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
icerdeira
Frequent Visitor

Applying a segmentation filter to a DAX formula

I need help to pass by parameter a Year value for a column or measure in DAX. So far I have only been able to indicate the minimum value of the year (2015), but what I need is not to have to indicate it manually but to change it with the segmentation filter. I need the average price for 2015 and the average price for 2020. I would like it to change as I change the value in the segmentation filter and not have to change it manually in the formula.

 

Thanks,

 

Isaac

 

icerdeira_0-1640085436224.png

 

 

 

 

icerdeira_1-1640085517042.png

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@icerdeira , You can use what if parameter

 

calculate(Avergae(Table[Value]), Filter(all(table), Table[Year] = [what if measure]))

 

https://docs.microsoft.com/en-us/power-bi/desktop-what-if

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@icerdeira , You can use what if parameter

 

calculate(Avergae(Table[Value]), Filter(all(table), Table[Year] = [what if measure]))

 

https://docs.microsoft.com/en-us/power-bi/desktop-what-if

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hello @amitchandak ,

 

Thanks for your answer. I'm trying to do it and it says: Need one more argument in my function.

I created a what if, with the years from 2006 to 2025 and make the relation and it works ok.

 

There is something wrong on my formula.

 

Thanks!

 

Isaac

 

icerdeira_0-1640113441882.png

 

Icey
Community Support
Community Support

Hi @icerdeira ,

 

icerdeira_0-1640113441882.png

Closing parenthesis is missing after ALL('Mercado' and there is an extra closing parenthesis at the end of the expression.

 

 

Best Regards,

Icey

 

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

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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