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.
Hello community,
can onyone help me to calculate the number of days until a value doubles? I have searched online but couldnt find helpful ressources. Does anyone have something at hand?
Solved! Go to Solution.
Hi, @raymond
Based on my research, you may create a measure as below.
CountDays =
var _maxdate =
CALCULATE(
MAX('Table'[Date]),
ALLSELECTED('Table')
)
var _maxvalue =
LOOKUPVALUE(
'Table'[Value],
'Table'[Date],
_maxdate
)
var _halfvaluedate =
LOOKUPVALUE(
'Table'[Date],
'Table'[Value],
CALCULATE(
MAX('Table'[Value]),
FILTER(
ALLSELECTED('Table'),
'Table'[Value]<=_maxvalue/2
)
)
)
return
DATEDIFF(
_halfvaluedate,
_maxdate,
DAY
)+1
Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @raymond
Based on my research, you may create a measure as below.
CountDays =
var _maxdate =
CALCULATE(
MAX('Table'[Date]),
ALLSELECTED('Table')
)
var _maxvalue =
LOOKUPVALUE(
'Table'[Value],
'Table'[Date],
_maxdate
)
var _halfvaluedate =
LOOKUPVALUE(
'Table'[Date],
'Table'[Value],
CALCULATE(
MAX('Table'[Value]),
FILTER(
ALLSELECTED('Table'),
'Table'[Value]<=_maxvalue/2
)
)
)
return
DATEDIFF(
_halfvaluedate,
_maxdate,
DAY
)+1
Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
The information you have provided is not making the problem clear to me. Can you please explain with an example.
Appreciate your Kudos.
It should work a little like this. Depending on the date selection one makes, the measure should calculate the number of days that are between the largest value (here accumulated) and half of the value.
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 | |
100 | |
80 | |
64 | |
57 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |