Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi,
I think my problem must be easy to solve but I don't manage to find my error.
I have a some production values (EnergyInvoiced) displayed over time axis (mois) and I wish to display on a card the trend line slope factor (coefficient directeur in french).
I created a measure to calculate this factor but it returns only "Blank" :
Hello, did anyone find out??
Hi @Cado_one ,
The reason why the measure result is negative is because the X-axis is calculated as a negative value.
You only need to exchange the positions of the two parameters in the DATEDIFF() function.
Best regards,
Lionel Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I think there is a misunderstanding on the objective of the measure. Your measure calculates the slope factor of a line passing by the first and the last value of the data (blue line of your report), what I need is the slope factor of the trend line (red dashed line of your report)
For example in the screenshot below, when filtering the date on the period 2003-2013 you measure returns a factor of -10% (value on lastdate - value on first date)/(lastdate-firstdate) = (7-6)/(2013-2003) = -0,1 = 10%
What I need is (12 - 4)/(2013-2003) = 8/10 = 0,8
Sorry for my bad english I have difficulties descripting precisely my need, if it's not clear don't hesitate asking me questions.
Best regards
Cado
I wish you a happy new year !
Did you thought any update tot his issue ?
Thanks in advance,
Cado
Hi @Cado_one ,
Please refer to my formula.
Measure =
VAR __min = MINX(ALLSELECTED(Sheet1), [Date] )
VAR __max = MAXX(ALLSELECTED(Sheet1), [Date] )
RETURN
VAR x =
SUMX(
FILTER( ALL(Sheet1), [Date] = __min ),
[Value]
)
VAR y =
SUMX(
FILTER( ALL(Sheet1), [Date] = __max ),
[Value]
)
RETURN
(y- x)/
DATEDIFF(
__max, __min,
YEAR
)
Best regards,
Lionel Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for helping me.
I think there is a misunderstood or there is a problem with your formula. Your trend line is climbing so the factor should be positive. If we calculate it manually between 2003 and 2013 for example we would have :
factor = (12 - 5)/(2013-2003) = 7/10 = 70% --> the value increase by 0,7/year
Moreover, I need this factor to adapt automatically if I change the date period (with a slicer).
How can we deal with that ?
Best regards,
Cado
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
76 | |
76 | |
56 | |
38 | |
34 |
User | Count |
---|---|
99 | |
56 | |
51 | |
44 | |
40 |