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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Display data from different columns in one column based on slicer

I have a situation where the user needs to select between two possible options (in a slicer, presumably), and based on their selection, we then decide which column should populate the column of a table visual.

 

For example, consider this very basic data source:

BIC_ACdata.PNG

 

In my table visual, I want the user to be able to select either BIC or AC in a slicer, and then based on their choice, the first column of the visual will be populated by either the BIC or AC column. So if they choose BIC, the data visual displays this data:

bic.PNG

And if they choose AC, they see this:

AC.PNG

 

It seems like this shouldn't be too complicated, but I can't quite get it. I did find this post, but can't make it work with my data: https://community.powerbi.com/t5/Community-Blog/Dynamic-Hideable-Columns-in-Power-BI-Table-Visual/ba...

 

Here's the attached .pbix that I'd like to make work:

 

And what it looks like now: 

choose column in pbix.PNG

Thanks!

1 ACCEPTED SOLUTION
v-lid-msft
Community Support
Community Support

Hi @Anonymous ,

 

In your scenario, there should be a unique column to show the table normally, there is also a unique column in the post you found called catagory, you can try to delete the column and you will find the table cannot show completely.

 

If you do not have such a column, you can use power query editor to index it, for examle, i use the suffix as the unique column and create a measure like this,

 

AC/BIC = 
IF (
    SELECTEDVALUE ( 'Choose Account'[Source] ) = "AC",
    LOOKUPVALUE ( Sheet1[AC], Sheet1[INDEX], SELECTEDVALUE ( Sheet1[INDEX] ) ),
    IF (
        SELECTEDVALUE ( 'Choose Account'[Source] ) = "BIC",
        LOOKUPVALUE ( Sheet1[BIC], Sheet1[INDEX], SELECTEDVALUE ( Sheet1[INDEX] ) )
    )
)

SelectColumn-1.PNGSelectColumn-2.PNG

BTW, pbix as attached.

 

Best regards,

 

Community Support Team _ DongLi
If this post helps, then please consider Accept it as the solution to help the other members find it more

Community Support Team _ Dong Li
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

11 REPLIES 11

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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