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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Analitika
Post Prodigy
Post Prodigy

Date slicer in Power BI desktop

Hello,

 

I would like to ask you how to write calculation formula in order to calculate a measure using only second part of date. I mean I have a slicer:

Analitika_0-1641279507989.png

But I need that formula will respond only to these changes:

Analitika_1-1641279563767.png

Analitika_2-1641279590238.png

Means when I I turn left, turn right this slicer. I used FILTER('Date', Date<=MAX(Date) but it didn't help because it still responds to both dates.

8 REPLIES 8
v-xiaotang
Community Support
Community Support

Hi @Analitika 

Hope you are doing well.

Have you solved this question? If you need more help, we'd like to help you. If you have solved this question, you can accept the answer helpful as the solution or share you method and accept it as solution, thanks for your contribution to improve Power BI.❤️

 

Best Regards,

Community Support Team _Tang

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

v-xiaotang
Community Support
Community Support

Hi @Analitika 

Create an independent calendar table,

Date = CALENDAR(DATE(2021,1,1),DATE(2021,12,31))

then create a measure and put it into visual-level filter,

filter = 
    var _max=MAXX(ALLSELECTED('Date'),'Date'[Date])
return IF(MAX('Table'[Date])<=_max,1,0)

Sum code:

Sum = 
    var _max=MAXX(ALLSELECTED('Date'),'Date'[Date])
return
    CALCULATE(SUM('Table'[Value]),FILTER(ALLSELECTED('Table'),'Table'[Date]<=_max))

vxiaotang_1-1641533503506.png

 

 

 

 

 

Best Regards,

Community Support Team _Tang

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

amitchandak
Super User
Super User

@Analitika , Try a measure like given example


New Measure =
Var _max = maxx(allselected(Date) , Date[date])
return
calculate(sum(Table[value]), filter('Date', Date[date] =_max))

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

I have testes it not works. Seems not calculating at all.

@Analitika , Try like

New Measure =
Var _max = maxx(allselected(Date) , Date[date])
return
calculate(sum(Table[value]), filter(all('Date'), Date[date] =_max))

 

If this does not help
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

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

Hello,

 

That not works at all.

I am also getting error that syntax for [date] is incorrect. 

I used this formula for calculation so how to change it?

Analitika_0-1641280346261.png

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors