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
Anonymous
Not applicable

Calculate value by taking the data from starting till the date selected in slicer

Hi all, 

 

Need help in creating the measure to calculate value from starting date till the date slected in slicer, for example we have data from 2018 jan. If we select relative date as last 60 days, then we need to get data from 2018 jan till today-60 days. So we need subtract those relative date days from today. 

 

Thanks in advance 

Sai 

 

 

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Anonymous , Not very clear , Check this

https://community.powerbi.com/t5/Desktop/Required-custom-date-Slicer-Last-7-days-last-15-days-last-30/m-p/1284966#M561629

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

Anonymous
Not applicable

Hi @Anonymous 

I think you may want to calculate the values from 2018 Jan(Start Date) untill the calculate date by today - daydiff you select in slicer. Ex if you select last 60 days, you may want to calculate values from 2018 Jan untill (2020/11/05-60). In other words, you need the values in which daydiff >=60.

I build a sample to have a test,

Data Table (I add a dynamicdaydiff column in this table by calculated column): 

DynamicDayDiff = DATEDIFF(Data[Date],TODAY(),DAY)

1.png

Slicer Table:

2.png

 My Measure:

M.value = 
Var _DayDiff = CALCULATE(MAX(Slicer[DayDiff]),FILTER(Slicer,Slicer[Relative Date]=SELECTEDVALUE(Slicer[Relative Date])))
Var _Value = CALCULATE(SUM(Data[Value]),FILTER(Data,Data[DynamicDayDiff]>=_DayDiff))
Return
_Value

Result is as below.

By default, the table visual will show all values.

1.png

Select Last 60 days, it will show results from 2020/01/01 until (2020/11/05-60) = 2020/09/06.

2.png

If this reply still couldn't help you solve your problem, please provide me more details about your table, the result you want(screenshots may be better).

Or you can share me with your pbix file by your Onedrive for Business.

You can download the pbix file from this link: Calculate value by taking the data from starting till the date selected in slicer

 

Best Regards,

Rico Zhou

 

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

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.

 

Best Regards,

Rico Zhou

Anonymous
Not applicable

Hi @Anonymous 

I think you may want to calculate the values from 2018 Jan(Start Date) untill the calculate date by today - daydiff you select in slicer. Ex if you select last 60 days, you may want to calculate values from 2018 Jan untill (2020/11/05-60). In other words, you need the values in which daydiff >=60.

I build a sample to have a test,

Data Table (I add a dynamicdaydiff column in this table by calculated column): 

DynamicDayDiff = DATEDIFF(Data[Date],TODAY(),DAY)

1.png

Slicer Table:

2.png

 My Measure:

M.value = 
Var _DayDiff = CALCULATE(MAX(Slicer[DayDiff]),FILTER(Slicer,Slicer[Relative Date]=SELECTEDVALUE(Slicer[Relative Date])))
Var _Value = CALCULATE(SUM(Data[Value]),FILTER(Data,Data[DynamicDayDiff]>=_DayDiff))
Return
_Value

Result is as below.

By default, the table visual will show all values.

1.png

Select Last 60 days, it will show results from 2020/01/01 until (2020/11/05-60) = 2020/09/06.

2.png

If this reply still couldn't help you solve your problem, please provide me more details about your table, the result you want(screenshots may be better).

Or you can share me with your pbix file by your Onedrive for Business.

You can download the pbix file from this link: Calculate value by taking the data from starting till the date selected in slicer

 

Best Regards,

Rico Zhou

 

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

amitchandak
Super User
Super User

@Anonymous , Not very clear , Check this

https://community.powerbi.com/t5/Desktop/Required-custom-date-Slicer-Last-7-days-last-15-days-last-30/m-p/1284966#M561629

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

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