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

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

Reply
Anonymous
Not applicable

Using slicer to get date and put into column

Hi,
I want to use the slicer input to get the value (date) and substract the date with the other date in the other table.
I already create a measure with this DAX,

DateSelected = SELECTEDVALUE(DateInput[DateInput])

 but then I try to get the value to minus the date with the other date in the other table. I also tried to create a new column in other table (INVENTBATCH) with this DAX but it does not work

Days = 
VAR selected = DateSelected
return
selected-[XFSRECEIVEDATE].[Date]


How can I solve this?

1 ACCEPTED SOLUTION
hansei
Helper V
Helper V

Calculated columns are calculated once - on load. So SELECTEDVALUE will never be valid, and the column will not react to any changes you make in the report.

 

Instead, create another measure akin to

Days = SELECTEDVALUE(DateInput[DateInput]) - SELECTEDVALUE(INVENTBATCH[XFSRECEIVEDATE])

 and add the measure to the table or matrix where you want the value to appear. As long as rows are not summarized (so XFSRECEIVEDATE only has one value in a row), it should work. You may want to add ISBLANK tests or alternate values in the second argument to SELECTEDVALUE in order to handle cases where values are not scalar

View solution in original post

7 REPLIES 7
amitchandak
Super User
Super User

Try

Days = 
VAR selected = SELECTEDVALUE(DateInput[DateInput])
return
datediff(selected,max([XFSRECEIVEDATE].[Date]),day)

//////////////////OR

Days = 
VAR selected = maxx(SELECTEDVALUE(DateInput),DateInput[DateInput])
return
datediff(selected,max([XFSRECEIVEDATE].[Date]),day)
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
Anonymous
Not applicable

Hi @amitchandak ,

You can try to look at the comment that i mentioned @hansei where the result that I exactly want. I want the result by row and not a single result. Thank you.

As stated, just put the measure in the table visual. It will calculate for each row
Anonymous
Not applicable

@hanseiboth of it return with blank results.

Works fine for me2020-03-18 (4).png2020-03-18 (3).png

hansei
Helper V
Helper V

Calculated columns are calculated once - on load. So SELECTEDVALUE will never be valid, and the column will not react to any changes you make in the report.

 

Instead, create another measure akin to

Days = SELECTEDVALUE(DateInput[DateInput]) - SELECTEDVALUE(INVENTBATCH[XFSRECEIVEDATE])

 and add the measure to the table or matrix where you want the value to appear. As long as rows are not summarized (so XFSRECEIVEDATE only has one value in a row), it should work. You may want to add ISBLANK tests or alternate values in the second argument to SELECTEDVALUE in order to handle cases where values are not scalar

Anonymous
Not applicable

Hi @hansei ,
I want to calculate for each row. Means that if I have 3 dates in XFSRECEIVEDATE, it will come out with 3 rows that show the result of minus operation.

Example, selected values is 01/01/2035 and the field (result) is the result that i want.

 

XFSRECEIVEDATEresult
01/01/20205479
31/12/20118402
14/05/20099363

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.