Forum Discussion
Dynamic Reference Line on line chart
Hi there,
I was wondering if it is possible to add a dynamic reference line to a line chart.
In my line chart I have some filtered products by a slicer. On the y-axis i have price and x-axis i have date.
My objective is to show a dynamic reference line, where it takes the cheapest filtered product and adds the value 50 to the price. It should be dynamic, so that it takes the cheapest product from that particular date and not the general cheapest product.
I would like to show the dynamic reference line on the line chart.
I have tried to draw how it should be (the red line is the dynamic reference line that im seeking):
Any help would be very appreciated.
Thanks in advance!
Hi ajazz ,
Sorry for the late reply.
Create 2 measures as below:
Average = AVERAGEX ( FILTER ( ALLSELECTED ( MedicinPriserUnpivot ), 'MedicinPriserUnpivot'[Varenummer] = MAX ( MedicinPriserUnpivot[Varenummer] ) && 'MedicinPriserUnpivot'[Dato] = MAX ( 'MedicinPriserUnpivot'[Dato] ) ), 'MedicinPriserUnpivot'[Pris] )Measure2 = VAR _tab = CALCULATETABLE ( VALUES ( 'Vareoversigt'[Varenummer] ), FILTER ( ALL ( Vareoversigt ), 'Vareoversigt'[Substitutionsgruppe] IN FILTERS ( Vareoversigt[Substitutionsgruppe] ) ) ) RETURN CALCULATE ( MINX ( ALLSELECTED ( MedicinPriserUnpivot ), [Average] ), FILTER ( ALLSELECTED ( 'MedicinPriserUnpivot' ), 'MedicinPriserUnpivot'[Dato] = MAX ( 'MedicinPriserUnpivot'[Dato] ) && 'MedicinPriserUnpivot'[Varenummer] IN _tab ) ) + 50And you will see:
For the related .pbix file,pls see attached.
Best Regards,
KellyDid I answer your question? Mark my reply as a solution!
16 Replies
- v-kelly-msftCommunity Support
Hi ajazz ,
Could you pls provide some sample data with expected output for test?
Remember to remove the confidential information.
Best Regards,
KellyDid I answer your question? Mark my reply as a solution!
- ajazzFrequent Visitor
Hi,
I have attached a sample data set here:
https://we.tl/t-RNSBlkM5Vf
THANKS!
- v-kelly-msftCommunity Support
Hi ajazz ,
I see your data,how to caculate the reference line?
I took part of your data as below:
Could you pls advise me how to get the reference line?What is the calculation logic?
Best Regards,
KellyDid I answer your question? Mark my reply as a solution!
- ajazzFrequent Visitor
Hi again,
It needs to be average price per ProductNumber.
Then a slicer to select 3-4 productnumbers.
Of the "filtered" view, the reference line needs to take the ProductNumber with the lowest price and add +50 to it.Does that make sense?
- v-kelly-msftCommunity Support
Hi ajazz ,
Do you mean that the reference line is combined by loweast price of each month +50?
Best Regards,
KellyDid I answer your question? Mark my reply as a solution!