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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Anonymous
Not applicable

Using Column headers as slicer

The standard answer in the message boards is to unpivot specific columns, but if if I do that, the dataset baloons from a few thousand rows to a few hundred thousand rows because im trying to unpivot something like 30 columns. I havent quite cracked the sanddance 3d plot yet, but something like that could be an option also.

 

Backstory, i have an oil analysis database that has analysis date (my preferred x) and multiple partlcle columns (my y) of iron, glycol, etc. If I could use the column header as a button filter to toggle particles, it would be ideal.

 

My current state. plotting a single particle is easy enough, but I want to make the graph available to non-power bi savvy users, avoid the drag and drop, and preferably have a click from a dropdown as if it were an upivoted table.

Screenshot 2022-03-14 125012.png

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

You could try to create a column header table like

vstephenmsft_0-1647485240204.png

 

Then create a measure with the SWITCH function.

Measure =
SWITCH (
    SELECTEDVALUE ( 'Table (2)'[Column Headers] ),
    "glycol", SUM ( 'Table'[glycol] ),
    "iron", SUM ( 'Table'[iron] ),
    "lead", SUM ( 'Table'[lead] ),
    "magnesium", SUM ( 'Table'[magnesium] )
)

 

Results:

vstephenmsft_1-1647485299651.png

vstephenmsft_2-1647485307230.png

vstephenmsft_3-1647485316726.png

 

You can download the attachment for more details.

 

 

Best Regards,

Stephen Tao

 

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

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

 

You could try to create a column header table like

vstephenmsft_0-1647485240204.png

 

Then create a measure with the SWITCH function.

Measure =
SWITCH (
    SELECTEDVALUE ( 'Table (2)'[Column Headers] ),
    "glycol", SUM ( 'Table'[glycol] ),
    "iron", SUM ( 'Table'[iron] ),
    "lead", SUM ( 'Table'[lead] ),
    "magnesium", SUM ( 'Table'[magnesium] )
)

 

Results:

vstephenmsft_1-1647485299651.png

vstephenmsft_2-1647485307230.png

vstephenmsft_3-1647485316726.png

 

You can download the attachment for more details.

 

 

Best Regards,

Stephen Tao

 

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

 

 

 

 

Anonymous
Not applicable

I have also created a reference table of particle that almost gets me to where I need to go by letting me click what are in effect column headers, I just can't plot more than one particle. 

Helpful resources

Announcements
FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.