Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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?
Solved! Go to Solution.
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
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)
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.
Works fine for me
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
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.
XFSRECEIVEDATE | result |
01/01/2020 | 5479 |
31/12/2011 | 8402 |
14/05/2009 | 9363 |
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
95 | |
76 | |
63 | |
55 |
User | Count |
---|---|
142 | |
107 | |
89 | |
84 | |
65 |