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

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.

Reply
PBIBee321
Regular Visitor

First Derivative of the X values vs Y in line chart

Hi All,

 

I want to plot the first derivative d(I)/d(V) as my Y axis and V as my X axis.The below is my sample table .I am not sure how can I plot the first derivative of d(I)/d(v) vs V in a line chart. Is there any measure we can write to handle this?

 

I tried in excel but it didnt work (A4-A2)/(B4-B2) assuming A as V and B as I column. I got DIV error in excel. I am now trying in PBI, using any measures or calculated columns  approach to calculate the first derivative for my V values ,can someone provide an approach? 

 

My data source table is as below:-

 

VI
0.0072.157
0.0152.279
0.0232.279
0.0312.206
0.0392.328
0.0472.304
0.0552.328
0.0632.426
0.0712.377
0.0792.426
0.0862.426
0.0942.377
0.1022.475
0.112.451
0.1182.451
0.1262.5
0.1342.551
0.1422.574
0.152.574
0.1582.549
0.1662.574
0.1732.549
0.1812.623
0.1892.672
0.1972.623
0.2052.696
0.2132.721
0.2212.647
0.2292.745
0.2372.696
0.2452.77
0.2522.819
0.262.77
0.2682.843
0.2762.868
0.2842.819
0.2922.892
0.32.843
0.3082.892
0.3162.941
0.3242.868
0.3322.941
0.3392.99
0.3472.917
0.3552.99
0.3632.941
0.3713.015
0.3793.015
0.3872.966
0.3953.015
0.4033.088
0.4113.015
0.4183.088
0.4263.015
0.4343.088
0.4423.113
0.453.039
0.4583.088
0.4663.113
0.4743.064
0.4823.137
0.493.064
0.4973.137
0.5053.137
0.5133.088
0.5213.137
0.5293.162
0.5373.113
0.5453.162
0.5533.113
0.5613.137
0.5693.186
0.5773.137
0.5843.162
0.5923.211
0.63.137
0.6083.186
0.6163.137
0.6243.186
0.6323.211
0.643.137
0.6483.211
0.6563.235
0.6633.162
0.6713.211
0.6793.162
0.6873.211
0.6953.235
0.7033.186
0.7113.235
0.7193.26
0.7273.186
0.7353.235
0.7433.186
0.753.235
0.7583.26
0.7663.186
0.7743.235
0.7823.26
0.793.211
0.7983.26
0.8063.186
0.8143.235
0.8223.26
0.8293.211
0.8373.26
0.8453.284
0.8533.211
0.8613.26
0.8693.211
0.8773.26
0.8853.284
0.8933.211
0.9013.26
0.9083.284
0.9163.211
0.9243.26
0.9323.211
0.943.26
0.9483.284
0.9563.211
0.9643.26
0.9723.309
0.983.235
0.9883.284
0.9953.211
1.0043.26
1.0123.284
1.023.235
1.0273.284
1.0353.309
1.0433.235
1.0513.284
1.0593.235
1.0673.284
1.0753.309
1.0833.235
1.0913.284
1.0993.309
1.1073.235
1.1143.309
1.1223.235
1.133.284
1.1383.309
1.1463.26
1.1543.309
1.1623.333
1.173.26
1.1783.309
1.1863.26
1.1933.309
1.2013.333
1.2093.26
1.2173.333
1.2253.333
1.2333.284
1.2413.333
1.2493.284
1.2573.333
1.2653.358
1.2733.284
1.283.358
1.2883.382
1.2963.309
1.3043.358
1.3123.284
1.323.358
1.3283.382
1.3363.309
1.3443.382
1.3523.407
1.3593.333
1.3673.382
1.3753.333
1.3833.382
1.3913.407
1.3993.333
1.4073.407
1.4153.431
1.4233.358
1.4313.407
1.4383.358
1.4463.407
1.4543.431
1.4623.382
1.473.431
1.4783.456
1.4863.382
1.4943.456
1.5023.382
1.513.456
1.5183.48
1.5253.431
1.5333.48
1.5413.505
1.5493.431
1.5573.505
1.5653.431
1.5733.505
1.5813.529
1.5893.456
1.5973.529
1.6043.554
1.6123.48
1.623.529
1.6283.48
1.6363.529
1.6443.578
1.6523.505
1.663.578
1.6683.627
1.6763.529
1.6843.578
1.6913.529
1.6993.578
1.7073.603
1.7153.554
1.7233.603
1.7313.652
1.7393.554
1.7473.627
1.7553.554
1.7633.627
1.773.676
1.7783.627
1.7863.676
1.7943.701
1.8023.627
1.813.701
1.8183.603
1.8263.676
1.8343.725
1.8423.652
1.8493.725
1.8573.75
1.8653.676
1.8733.75
1.8813.676
1.8893.75
1.8973.775
1.9053.725
1.9133.799
1.9213.824
1.9293.75
1.9363.799
1.9443.775
1.9523.824
1.963.848
1.9683.799
1.9763.848
1.9843.897
1.9923.848
23.946
2.0083.873
2.0153.946

 

Expected dI/dV(as Y axis) vs V (As X axis)plot

 

I know my values are not much tidy, I just want to know the kind of plot I will get for my above values.Even if it is not close to the expected screenshot below

 

PBIBee321_0-1668021241306.png

 

Kind regards

Guthu

 

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

Your data is pretty noisy, but you can still do the difference quotient approximation as follows:

 

dI/dV =
VAR V_Curr = SELECTEDVALUE ( Table1[V] )
VAR V_Prev = CALCULATE ( MAX ( Table1[V] ), Table1[V] < V_Curr )
VAR I_Curr = CALCULATE ( SUM ( Table1[I] ), Table1[V] = V_Curr )
VAR I_Prev = CALCULATE ( SUM ( Table1[I] ), Table1[V] = V_Prev )
RETURN
    DIVIDE ( I_Curr - I_Prev, V_Curr - V_Prev )

 

 

Since your data is so noisy, this is all over the place:

AlexisOlson_0-1668037106333.png

View solution in original post

2 REPLIES 2
AlexisOlson
Super User
Super User

I'd strongly recommend smoothing your data before trying to do anything like a derivative. In this particular case, you can approximate your data quite well with a 4th-degree polynomial and then take the derivative of that approximation.

 

This will lead to much cleaner results like this:

AlexisOlson_0-1668039865714.png

AlexisOlson
Super User
Super User

Your data is pretty noisy, but you can still do the difference quotient approximation as follows:

 

dI/dV =
VAR V_Curr = SELECTEDVALUE ( Table1[V] )
VAR V_Prev = CALCULATE ( MAX ( Table1[V] ), Table1[V] < V_Curr )
VAR I_Curr = CALCULATE ( SUM ( Table1[I] ), Table1[V] = V_Curr )
VAR I_Prev = CALCULATE ( SUM ( Table1[I] ), Table1[V] = V_Prev )
RETURN
    DIVIDE ( I_Curr - I_Prev, V_Curr - V_Prev )

 

 

Since your data is so noisy, this is all over the place:

AlexisOlson_0-1668037106333.png

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.