Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Filter in Linechart

Hi everyone, I'm stuck on a seemingly simple problem. I have a linechart that i want to use filters on, my data looks like this (very simplified)

and the chart looks like this. Now i want to be able to filter by tax applied (Yes/No) and Discount Given (Yes/No), but cant make it work. How would you go about this?

 Many Thanks

  • Hi Anonymous  To acheive this , first you need to convert your data table to the below format. See image:

     

    Follow the below steps to achieve such transformation:

    Import data table to below format:

    Select first column and transform table :

    Promoted as header first row.
    Then select red marking column and unpivot other columns. See image:

    Now you will get your desired result.

    Close and load and define your desired visuals. See image:

     

    After applying filter:

     

     

     

    Hope this helps!!

    If this solved your problem, please accept it as a solution and a kudos!!

     

     

    Best Regards,
    Shahariar Hafiz

4 Replies

  • Hi Anonymous, 

    Your data structure currently has "Tax applied" and "Discount given" as separate rows. To use them as filters, they need to be part of the same row for each day and product category. Restructure the data like this:

    Day Product Value Tax Applied Discount Given

    MondayApples10YesNo
    MondayBananas4NoYes
    MondayCarrots9YesNo
    TuesdayApples12YesNo
    TuesdayBananas7NoYes
    TuesdayCarrots15YesNo
    FridayApples9YesNo
    FridayBananas15NoYes
    FridayCarrots13YesNo


    To achieve this, you can use pivot/unpivot option available in Power Query editor.

    Once the data is in column format, you can use them in a slicer

  • Hi Anonymous  To acheive this , first you need to convert your data table to the below format. See image:

     

    Follow the below steps to achieve such transformation:

    Import data table to below format:

    Select first column and transform table :

    Promoted as header first row.
    Then select red marking column and unpivot other columns. See image:

    Now you will get your desired result.

    Close and load and define your desired visuals. See image:

     

    After applying filter:

     

     

     

    Hope this helps!!

    If this solved your problem, please accept it as a solution and a kudos!!

     

     

    Best Regards,
    Shahariar Hafiz

  • vanessafvg's avatar
    vanessafvg
    Community Champion

    when you say you can't make it work, what do you  mean exactly.  have you put slicers on the page?

  • Uzi2019's avatar
    Uzi2019
    Community Champion

    Hi Anonymous 

    Can you share the raw data screenshot???
    it seems unclear to me..

    go to table view and sahre the screenshot..