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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Nini1
Frequent Visitor

How Slicer Filter can affect column calculations?

Hello everyone,

 

I'm a new user of Power BI and need your help to solve the problem.

I have a data of customer who have unique identifier and corresponding date field.

 

Nini1_0-1640781608459.png

I want to create a column of min and max date values. e.g. in this case min (date) would be 1/15/2021 and max(date) 12/1/2021. Just I want these columns of max and min values to be changed depending on slicer filter. Namely, when I mark on slicer dates from 2/23/2021 to 10/25/2021 then column for maximum date should be 8/20/2021 and column for minimum date should be 3/19/2021 for the table above. 

 

I've tried to write function like this but did not work.

maxDateAll= CALCULATE ( MAX ( tbl[date] ), ALLSELECTED(tbl))

How can slicer filter affect not just visualization but also column/table calculations?

 

Could you please help me to solve this issue?

 

Thank you in advance

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Nini1 , Ideally these should work from Max and min

maxx(allselected(tbl) , tbl[date])

 

minx(allselected(tbl) , tbl[date])

 

But if slicer is on another table try like

maxDateAll=
Var _max = maxx(allselected(Date) , Date[date])
Var _min = minx(allselected(Date) , Date[date])
return
CALCULATE ( MAX ( tbl[date] ), filter(ALLSELECTED(tbl), tbl[date] <= _max && tbl[date] >= _min))

Share with Power BI Enthusiasts: 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

6 REPLIES 6
Anonymous
Not applicable

Hi @Nini1 ,

 

No, it's not possible. Since calculated column is static, it could not be dynamically changed based on the selection in slicer.

 

For your case, please use the same syntax to create measure instead:

max = CALCULATE(MAX('Table'[date]), ALLSELECTED('Table'))

Eyelyn9_0-1641260909323.png

 

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

Anonymous
Not applicable

Thank you, this solved my problem as well that no one on community could answer!

Thank you very much!

Anonymous
Not applicable

Hi @Nini1 ,

 

Thanks for your feedback, you are welcome😀

 

Best Regards,
Eyelyn Qin

amitchandak
Super User
Super User

@Nini1 , Ideally these should work from Max and min

maxx(allselected(tbl) , tbl[date])

 

minx(allselected(tbl) , tbl[date])

 

But if slicer is on another table try like

maxDateAll=
Var _max = maxx(allselected(Date) , Date[date])
Var _min = minx(allselected(Date) , Date[date])
return
CALCULATE ( MAX ( tbl[date] ), filter(ALLSELECTED(tbl), tbl[date] <= _max && tbl[date] >= _min))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank you very much!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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