0

Bizarre behaviour - second series mirroring first series despite different data

Hi

New to klipfolio but not to this type of thing. I am experimenting with a very simple data set from an API. There are 1439 rows. I have modelled it into three columns - Date, Headache, Neurology. The latter two are Yes/No/Blank

I created a klip with Bar/Line chart. I added a series for Neurology. Aggregation is Count. Filter is for "Yes" only.

x axis is Date. "Group Repeating Labels" is on. y Axis is number.

This works. I see the number of Yes responses to Neurology, all fine. However- the chart only goes back to Aug 2020 on the x axis when data i have spans back to June 2020 and I can see this in the Data tab. Why is this?

Secondly - when i try to add a very similar series for "Headache" this strange behaviour occurs where both series are identical to each other, but its clear from the data this isnt the case. Whats strange is when I add the "Yes" filter to "Headache", the whole chart jut turns into a 2 column nonsense with only 2 dates showing. 

Ive checked over and over and i cant see my error. I really want some help and dont know how to get access to a tutor. I couldnt find a facebook group or anything. Hoping i can get some help here!

 

{
"title": "Untitled",
"id": "",
"workspace": {
"dimensions": {
"w": 813
},
"datasources": []
},
"appliedMigrations": {
"post_dst": true,
"separate_root_dsts": true,
"result_rows2": true
},
"components": [
{
"type": "chart_series",
"id": "5f4e9a05-14",
"displayName": "Bar/Line Chart",
"dstContext": {
"id": "dst5f4e9a0514",
"kid": "",
"ops": [
{
"type": "filter",
"filterBy": "8dcd0b5a15",
"variation": "member",
"p": {
"type": "f",
"f": "in",
"args": [
{
"dim": "8dcd0b5a15"
},
{
"type": "f",
"f": "dst_array",
"args": [
{
"value": "\"Yes\""
}
]
}
]
}
},
{
"type": "filter",
"filterBy": "37472aff20",
"variation": "member",
"p": {
"type": "f",
"f": "in",
"args": [
{
"dim": "37472aff20"
},
{
"type": "f",
"f": "dst_array",
"args": [
{
"value": "\"Yes\""
}
]
}
]
}
},
{
"type": "group",
"groupBy": "b6d8220016"
}
],
"aggs": {
"df540a1f18": "auto",
"f5890cfb19": "auto",
"8dcd0b5a15": "auto",
"37472aff20": "auto"
}
},
"components": [
{
"type": "series_data",
"role": "series",
"id": "8dcd0b5a-15",
"displayName": "neurology",
"fmt": "txt",
"fmtArgs": {
"resultMetadata": {
"ignoreDateFormat": true,
"isAggregated": true,
"name": "Neurology",
"resultAutoDetectedFmt": {
"fmtArgs": {},
"defaultAggregate": "COUNT",
"fmt": "txt"
},
"formulaIsDataPointer": false,
"suggestedName": "Neurology",
"isDSTApplied": true,
"isGrouped": true,
"resultCount": 1
},
"autoFmt": {
"fmtArgs": {},
"defaultAggregate": "COUNT",
"fmt": "txt"
}
},
"formulas": [
{
"txt": "c06526fbd5aefcc0fc27ffb95361b82a#40deab4aa483167e9c7b890d56eaf535;",
"ver": 2
}
],
"data": [
[
1,
1
]
],
"autoFmt": true,
"seriesName": "neurology",
"axis": "dccac5b6-17"
},
{
"type": "series_data",
"role": "series",
"id": "37472aff-20",
"displayName": "Headache",
"fmt": "txt",
"fmtArgs": {
"resultMetadata": {
"ignoreDateFormat": true,
"isAggregated": true,
"name": "Headache",
"resultAutoDetectedFmt": {
"fmtArgs": {},
"defaultAggregate": "COUNT",
"fmt": "txt"
},
"formulaIsDataPointer": false,
"suggestedName": "Headache",
"isDSTApplied": true,
"isGrouped": true,
"resultCount": 1
},
"autoFmt": {
"fmtArgs": {},
"defaultAggregate": "COUNT",
"fmt": "txt"
}
},
"formulas": [
{
"txt": "c06526fbd5aefcc0fc27ffb95361b82a#c10949bacc9772f31725a2e1ba6fa67b;",
"ver": 2
}
],
"data": [
[
1,
1
]
],
"autoFmt": true,
"seriesName": "Headache",
"axis": "dccac5b6-17"
},
{
"type": "chart_axis",
"role": "axis_x",
"id": "b6d82200-16",
"displayName": "date",
"fmt": "dat2",
"fmtArgs": {
"resultMetadata": {
"ignoreDateFormat": false,
"isAggregated": false,
"name": "Date",
"resultAutoDetectedFmt": {
"fmtArgs": {
"dateInputFormatCustom": "d/M/yyyy",
"dateFormat": "custom",
"dateFormatCustom": "dd/MM/yyyy",
"dateInputFormat": "d/M/yyyy"
},
"defaultAggregate": "COUNT",
"fmt": "dat2"
},
"formulaIsDataPointer": false,
"suggestedName": "Date",
"isDSTApplied": true,
"isGrouped": true,
"resultCount": 1
},
"autoFmt": {
"fmtArgs": {
"dateInputFormatCustom": "d/M/yyyy",
"dateFormat": "custom",
"dateFormatCustom": "dd/MM/yyyy",
"dateInputFormat": "d/M/yyyy"
},
"defaultAggregate": "COUNT",
"fmt": "dat2"
},
"dateFormat": "dd/MM/yyyy",
"dateFormatCustom": "dd/MM/yyyy"
},
"formulas": [
{
"txt": "c06526fbd5aefcc0fc27ffb95361b82a#0748e2498c3568fdfe9ce85674c7f24a;",
"ver": 2
}
],
"data": [
[
"11/03/2021",
"13/11/2020"
]
],
"autoFmt": true,
"label": "date",
"showLabel": true,
"labelDrop": 0,
"showLabelTicks": true
},
{
"type": "chart_axis",
"role": "axis_y",
"id": "dccac5b6-17",
"displayName": "number",
"fmt": "txt",
"fmtArgs": {},
"formulas": [],
"data": [],
"autoFmt": true,
"dataDisabled": true,
"label": "number",
"showLabel": true,
"labelDrop": 0,
"grid": true
}
]
}
]
}

3 comments

  • 0
    Avatar
    adnaan qureshi

    I think the issue is filtering. when i apply a filter to one series, it seems to be acting on the other series too. i cant work out why. 

  • 0
    Avatar
    Yvonne Van Alphen

    Hi Adnaan

    Welcome to Klipfolio! Thanks for explaining your use case so well.

    We need to ensure that your data stays aligned when building a Klip using filtering, and that each sub-component evaluates to the same number of items.

    To ensure this happens, you can use the IF function in the formula bar for both of your series. For example, for the sub-component called Headache, you can set up the IF condition to say where the headache column is equal to yes (this is case sensitive), return a value of 1, and where it is equal to false, return a value of 0.

    You can then select your date column for your x: axis and apply a group filter so that it returns one unique set of dates. When you group the x:axis, Klipfolio automatically applies the equivalent of our Klipfolio “groupby” function to your series sub-components. This means all you need to do for each series is select an aggregation method.

    Lastly, select a sort method for how you want to display the dates on your x:axis.

    I noticed your dates include the year 1980. If you want, you can also filter this year out using an exclude filter. The [Blank] you see at the top of the list of dates is the header row, and it too can be filtered out by selecting it, and then selecting the exclude box.

    Let me know if this works for you. Happy to help further over a support ticket.

    Here some articles on filtering that you might find useful in the meantime.
    https://support.klipfolio.com/hc/en-us/articles/115004538487-How-do-I-filter-data-?query=filtering
    https://support.klipfolio.com/hc/en-us/articles/222017088-Using-the-Filter-Group-Aggregate-and-Sort-actions-videos-

    Yvonne

  • 0
    Avatar
    adnaan qureshi

    Thank you so much! yes i have not realised that filtering a series must apply to all series to maintain row numbers, and i am happy doing what i need with IF function as you have outlined so well. really appreciate your help.

Please sign in to leave a comment.