0

Bar chart not placing bars in correct locations

I am having trouble getting the correct placement and count of the bars in my bar chart. I have a feeling that I need to use the lookup function, but I can't seem to figure out how it works for my use case. I wish to select a certain property and view the number of passes there are for a specific arrival date. I started out with a simple select as that gives me the data that I need when I evaluate the function using the lightning bolt button, but when I try to use that data as the data for the series in a bar chart, it gives me seemingly random data back and not the data that went into the series

some sample data is

Seeing how the answer for others was to use lookup, this is what I came up with but it throws an error and I don't know why. 

lookup([x axis of bar chart]
    ,group(select(slice(left(@C:C,10))))
    ,group(SELECT(
        SLICE(left(@C:C;,10)),
        contains(slice(@B:B;),$Selected_Property))))

What gives me the proper data is 
SELECT(LEFT(@C:C;,10),contains(@b:b;,$Selected_Property))

Sampled here

My bar chart looks like this, and as you can see, I have no bars in the late 2023 - 2024 section which is where this property should have most of of its data. They're all in the 2022-2023 range. Changing the property changes the line patterns around, but nothing ever leaves the 2022-2023 range

1 comment

  • Avatar
    Parker Selman Official comment

    Hi Kalin,

    Thanks for the post! Happy to assist with this. 

    There's a few things about your formula that should be adjusted in order to get this working. Firstly, the date format of your raw data does not match that of your X axis, which will cause issues with your LOOKUP. Secondly, the SLICE functions are not required here and should be removed. 

    To resolve the first issue with your dates, you can either change the output format of the dates on your X axis to be 'yyyy-MM-dd' to match your raw data, or use the DATE_CONVERT function in your series formulas to convert your raw data to 'yyyy-M-d' format as such: 

    DATE_CONVERT(DATE(LEFT(@C:C,10) , "yyyy-MM-dd") , "yyyy-MM-dd" , "yyyy-M-d") 

    If you make the change to resolve the format issue, and remove the SLICE functions, the LOOKUP should return data properly. 

    I hope this helps! If you have any questions or would like us to take a closer look at your Klip, please submit a support ticket to support@klipfolio.com and someone from our team will be happy to investigate further. 

    Best,


    Parker

Please sign in to leave a comment.