Forum Discussion

KaniVan2's avatar
KaniVan2
New Member
1 year ago
Solved

Plotting column data based on selection

I have a database where the first column are historic dates. The remaining columns all contain historic data. Each columnheader has the following structure country+number

For example us2, us5, us10, uk2, uk5, uk10

In this example there are 2 options for countries and 3 for the number. These option data is also in a table. So i can make a dropdown containing us and uk and a dropdown with 2 5 10.

 

Lets say i now select us and 5. How can i make a graph plotting the data in the column us5.

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi KaniVan2 

     

    The following test is for your reference:

     

    My sample:

     

     

     

    Convert the columns into rows by using unpivot feature in Transform data(Power Query editor)

     

     

    Create a measure as follows

    Measure = 
    VAR _country = SELECTEDVALUE(Country[Country])
    VAR _number = SELECTEDVALUE(Number[number])
    VAR _name = _country & _number
    RETURN
    IF(SELECTEDVALUE('Table'[Attribute]) = _name, 1, 0)

     

    Put the measure into the visual-level filters, set up show items when the value is 1.

     

    Output:

     

    If this sample data is structurally different from the one you are using, please provide some sample data and the expected results based on the sample data so that we can better help you. How to provide sample data in the Power BI Forum - Microsoft Fabric Community Please remove any sensitive data in advance.

     

    Best Regards,
    Yulia Xu

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi KaniVan2 

     

    The following test is for your reference:

     

    My sample:

     

     

     

    Convert the columns into rows by using unpivot feature in Transform data(Power Query editor)

     

     

    Create a measure as follows

    Measure = 
    VAR _country = SELECTEDVALUE(Country[Country])
    VAR _number = SELECTEDVALUE(Number[number])
    VAR _name = _country & _number
    RETURN
    IF(SELECTEDVALUE('Table'[Attribute]) = _name, 1, 0)

     

    Put the measure into the visual-level filters, set up show items when the value is 1.

     

    Output:

     

    If this sample data is structurally different from the one you are using, please provide some sample data and the expected results based on the sample data so that we can better help you. How to provide sample data in the Power BI Forum - Microsoft Fabric Community Please remove any sensitive data in advance.

     

    Best Regards,
    Yulia Xu

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.