Forum Discussion

parvathisuku_90's avatar
6 years ago
Solved

Need help with multi line chart

_key grid_element_key date qty_alarms_7day duration_alarms_7day f25fc369-2e73-49d1-a6fe-16cb06b4b106 0fdd05a9-6977-4dac-8266-ffc42de6f171 2010-01-01 45.38917 3.814148 f25fc369-...
  • Anonymous's avatar
    Anonymous
    6 years ago

    HI parvathisuku_90,

    So you want to create a line chart with a graph of all categories of raw table records except selected items and display two lines of aggregate record line and selected item line for comparison?

    If this is a case, I'd like to suggest you create a new table stored value of category 'selected', "others" to use on the line chart as legends.

    After these steps, you can use the raw table id field to create a slicer and write measure formulas to interact with slicer to get results based on different line groups.

    Measure =
    VAR currLegend =
        SELECTEDVALUE ( Category[Legend] )
    VAR selected =
        ALLSELECTED ( RawTable[Key] )
    RETURN
        SWITCH (
            currLegend,
            "Selected",
                CALCULATE (
                    AVERAGE ( RawTable[Amount] ),
                    FILTER ( ALLSELECTED ( RawTable ), [Key] IN selected ),
                    VALUES ( RawTable[Date] )
                ),
            "Others",
                CALCULATE (
                    AVERAGE ( RawTable[Amount] ),
                    FILTER ( ALLSELECTED ( RawTable ), NOT ( [Key] IN selected ) ),
                    VALUES ( RawTable[Date] )
                )
        )
    

    Regards,

    Xiaoxin Sheng