Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
KaniVan2
New Member

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.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @KaniVan2 

 

The following test is for your reference:

 

My sample:

vxuxinyimsft_0-1738217760203.png

 

vxuxinyimsft_1-1738217825692.png

 

vxuxinyimsft_2-1738217920387.png

 

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

vxuxinyimsft_3-1738218230094.png

 

vxuxinyimsft_4-1738218303269.png

 

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.

vxuxinyimsft_5-1738218382135.png

 

Output:

vxuxinyimsft_6-1738218400611.png

 

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.

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @KaniVan2 

 

The following test is for your reference:

 

My sample:

vxuxinyimsft_0-1738217760203.png

 

vxuxinyimsft_1-1738217825692.png

 

vxuxinyimsft_2-1738217920387.png

 

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

vxuxinyimsft_3-1738218230094.png

 

vxuxinyimsft_4-1738218303269.png

 

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.

vxuxinyimsft_5-1738218382135.png

 

Output:

vxuxinyimsft_6-1738218400611.png

 

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.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.