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
gaoact1
Regular Visitor

How to make a price line chart like keepa?

Hi,

 

When I try to use the default line chart of power bi to make a price step chart like keepa (a amazon price tracker tool), I have the following problems:

 

1. The gradient function of the line chart will make the curve change in the middle, for example, from $68 on 2016/10/7 to $62 on 2016/10/9, there will be an undesired intermediate value in the middle of the curve, ideally it should be direct Falling, like step before in "power kpi".

0VL`~SV@%Y}LY4TOEHFJ2)7.png

2. When the price value is nan, it means that the product is out of stock, so the curve should be broken until a new price value appears next time. My current approach is to replace nan with 0 to make the curve bottom, but this method does not meet expectations.

@`KUJ4OKGO1RR}V}GRH}XN1.png

3. When the date is selected, the curve will be disconnected. For example, when the selected time is 2016/10/20-2016/11/30, the ideal situation is that the price of $62 on 2016/10/9 will be displayed directly, but the reality is, Only curves starting from $68 on 2016/11/16 will be displayed.

 

Below are a example of how keepa show price curve.

https://keepa.com/#!product/1-B07DJ4ZGZR

 

Thanks a lot if you can share a solution of the problesm above.

 

timenewprice
2016/10/7 13:3268
2016/10/9 8:4862
2016/11/26 6:5258
2016/11/27 8:1662
2016/12/8 11:1468
2016/12/16 20:50nan
2016/12/23 7:0068
2017/2/1 8:2465
2017/3/9 1:4268
2017/3/9 11:2065
2017/3/20 7:1468
2017/3/24 6:1265
2017/4/9 0:32nan
2017/4/11 0:3268
2017/4/12 15:26nan
2017/4/13 16:4265
2017/4/17 6:02nan
2017/4/18 13:1065
2017/7/10 14:4858.51
2017/7/11 3:4865
2017/7/17 2:3668
2017/7/30 15:04nan
2017/7/31 2:4468
2017/8/28 8:3665.99
2017/8/29 5:2868.99
2017/9/11 5:1065
2017/10/30 7:2063.99
1 REPLY 1
BA_Pete
Super User
Super User

Hi @gaoact1 ,

 

1) Change your line chart shape to 'Stepped' in chart formatting:

BA_Pete_2-1601021596454.png

 

 

2) Remove NaN in your data and replace with nulls. See how I did this by pasting this code over the default in a Blank Query in Power Query:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bVJJEsIwDPuKp2eGWM7m+CsMBz7Q/x9x0jI0gatkWXKUx2MTRgngUAnRomy3rej2vH2JRmpJOy4XHEEKFctdkHUmqitQVoUEJcCQVgsJKCRsmZ3ZX/tESaRqzJOmBpe4h4xV+QtHDwtLskwPGCb8My7s25dEA09+G2SZT76Hjze6xOw48CGuexwXQjYpfxSRUM6okwWqW/M/D+0NYT2iekeEdFSU9Z4xcaB4tjdrKonFsgT207kH5rTaOwNXpPWpNIh6E8emfG9tohr58cNcJ6r1XPn3Fv9tsTdyNBWH5vkG", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [time = _t, newprice = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"time", type datetime}, {"newprice", type number}}),
    #"Replaced Errors" = Table.ReplaceErrorValues(#"Changed Type", {{"newprice", null}})
in
    #"Replaced Errors"

 

Then, right-click on your axis field and select 'Show items with no data':

BA_Pete_1-1601021542637.png

 

3) I'm not really clear what you are asking for here, sorry.

 

Implementing steps 1) and 2) give me the following output:

BA_Pete_3-1601021671129.png

 

Pete

 



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




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.

Top Solution Authors