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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Dynamic Dimension based on Selected Slicer.

Hi,

I had one field which has two category values and I split them by custum method. Example below

Old Field                    New Field (Fruits)                    New Field(Vegetables)

Apple                           Apple                                        Brinjal

Orange                        Orange                                      Tommoto

Brinjal

Tommoto

 

Here my question is I need bar chart with single Dimenstion.

If I select fruits, it should show frutis as Dimenstion.  or    If I select Vegetables it should show Vegetalbles as Dimenstion.

 

My tried below Dax but it is not working.

New_Dim =   if(SelectedValue(New Field(Vegetables))>0, New Field(Vegetables), New Field (Fruits) )

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

Hi  @Anonymous  ,

Here are the steps you can follow:

1. Create measure.

Measure = 
if(SelectedValue('Table'[New Field(Vegetables)])<>BLANK(), MAX('Table'[New Field(Vegetables)]), MAX('Table'[New Field(Fruits)]) )

2. Place [New Field(Vegetables)] in the slice, and place [Old Field] in the table

3. Result:

When a null value is selected, [New Field(Fruits)] is displayed:

v-yangliu-msft_0-1612945636779.png

 

When the field in [New Field(Vegetables)] is selected, the corresponding data is displayed

v-yangliu-msft_1-1612945636781.png

 

You can downloaded PBIX file from here.

 

Best Regards,

Liu Yang

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

6 REPLIES 6
v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous  ,

Here are the steps you can follow:

1. Create measure.

Measure = 
if(SelectedValue('Table'[New Field(Vegetables)])<>BLANK(), MAX('Table'[New Field(Vegetables)]), MAX('Table'[New Field(Fruits)]) )

2. Place [New Field(Vegetables)] in the slice, and place [Old Field] in the table

3. Result:

When a null value is selected, [New Field(Fruits)] is displayed:

v-yangliu-msft_0-1612945636779.png

 

When the field in [New Field(Vegetables)] is selected, the corresponding data is displayed

v-yangliu-msft_1-1612945636781.png

 

You can downloaded PBIX file from here.

 

Best Regards,

Liu Yang

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

VijayP
Super User
Super User

@Anonymous 

Watch This Video

https://www.youtube.com/watch?v=_U2M0Hkotl4&list=PLWQB3PEUJKRneu8fam5CaCMCdrIdT_zDD&index=3

Watch from 10:43 onwards to know what you asked here!

In the next video there are much more details!

Let me know if this helps!




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


amitchandak
Super User
Super User

@Anonymous , I think a better idea would be a having a column and use that as filter

Type = if([col] in {"Apple","Orange"} , "Fruits","Vegetables")

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

Hi,

I get error. I created new column.

MuraliPrasathS_0-1612866805883.png

 

@Anonymous , syntax problem

 

Type = if([col] in {"Apple","Orange"} //condition

, "Fruits" //then value , only one

,"Vegetables" //else value only 1

)

 

You can also try switch : https://www.youtube.com/watch?v=gelJWktlR80

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

Hi, 

Thanks for the reply so far, I see that slicers are working as expected but now in chart I see the values (Fruits & Vegetables).   I only wanted to see default by fruits. Else On select Vegetable Slicer should show Vegetable categories as dimenstions. 

 

Please help me on this. Thanks!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.