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

Fieldnames in slicer for 1 chart

I have a report with 1 bar chart and 1 measure.

However I have 10 dimensions I want to plot the measure on.

Instead of creating 10 charts, all with a different dimension, I would like to introduce a slicer that let's the user select one of the possible 10 dimensions (fields in my table).

Then the chart should show the measure plotted on the selected dimension in the slicer.

 

I have just 1 Table with the following fields:

  • Total number
  • Age
  • Household size
  • Income group
  • Other dimension xyz

 

How to make a filter where the user selects one of the values (other than total number) and then get the chart plotted for the selected value.

 

Thanks for the hints and help

 

 

 

 

 

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

Hi @Anonymous ,

 

You should try to use the measure instead of the calculated column.

My variabele col =

VAR Selection =

    SELECTEDVALUE ( 'Ref table'[Variable] )

RETURN

    SWITCH (

        Selection,

        "Age", MAX ( 'Maintable'[Age] ),

        "Household size", MAX ( 'Maintable'[Householdsize] ),

        "Income group", MAX ( 'Maintable'[Income] )

    )

result1091129.gif

 

You can check more details from here.

 

 

Reference: Calculated columns and measures in DAX

 

 

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

3 REPLIES 3
v-stephen-msft
Community Support
Community Support

Hi @Anonymous ,

 

You should try to use the measure instead of the calculated column.

My variabele col =

VAR Selection =

    SELECTEDVALUE ( 'Ref table'[Variable] )

RETURN

    SWITCH (

        Selection,

        "Age", MAX ( 'Maintable'[Age] ),

        "Household size", MAX ( 'Maintable'[Householdsize] ),

        "Income group", MAX ( 'Maintable'[Income] )

    )

result1091129.gif

 

You can check more details from here.

 

 

Reference: Calculated columns and measures in DAX

 

 

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.

themistoklis
Community Champion
Community Champion

@Anonymous 

 

One alternative it to use buttons and bookmarks.

So on the same page you can add 10 buttons. Each button will be linked to a separate dimension.

 

In the same page you will have the same graph 10x times but on the click of every button only one will be displayed and the other 9 will be hidden.

Bookmarks will do this for you. You will create 10 bookmarks and for each boomark you can specify which objects will be visible and which ones will be hidden.

Anonymous
Not applicable

thanks themistoklis,

I have tried to do something with a calculated column and a small ref table (via Enter data).
The ref table with just 1 column with values that reflect the dimensions. This one I used for the slicer.
Then I created a calculated column that I put as the dimension of the chart. The calculated column goes like this:
IF the selected value of the new ref column =

My variabele col =
VAR Selection =
SELECTEDVALUE ( 'Ref table'[Variable] )
RETURN
SWITCH (
TRUE (),
Selection = "Age", Maintable[Age],
Selection = "Household size", Maintable[Householdsize],
Selection = "Income group", Maintable[Income]
)

Somehow this doesn't work....

Who can help me fix this or look in the right direction?

Thanks!
J

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.