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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Change columns based on measure value

Hello there!

 

I would like to ask if, if there are any possibilities to create a measure to select column in the visuals or other ways to change columns based on selected value?

 

Here is my example:

https://www.dropbox.com/s/llq96jalictauxy/SwitchLanguage.pbix?dl=0

 

I have the SelectedLanguage measure, which returns the selected value based on a slicer. If I choose Czech language, I want to display Department and Country values in Czech from D_Department and D_Country tables.

 

Could you, please, help me with it?

Thank you in advance!

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

Hi @Anonymous ,

You cannot create column "C" based on your measure's value. 

Calculated columns are only calculated when you first define them and during a dataset refresh, it will not change by filters, it is a definite value, if you expect the value changes with filter, you can only use a measure.

 

In a measure, columns cannot be referenced directly, MAX function in a measure can return the current value in the same row of the column.

 

You can learn more about measures and calculated column in this article: calculated-measures-vs-calculated-columns

 

And according your provided,you could create a measure like the below:

country1 = IF(SELECTEDVALUE(SwitchLanguage[Language])="English",MAX(F_Workers[Country]),LOOKUPVALUE(D_Country[Czech],D_Country[English],MAX(F_Workers[Country])))

vluwangmsft_0-1650265833463.pngvluwangmsft_1-1650265857596.png

 

Did I answer your question? Mark my post as a solution!


Best Regards

Lucien

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

@v-luwang-msft 

yes, it helped, thank you! I made the same way you showed

v-luwang-msft
Community Support
Community Support

Hi @Anonymous ,

You cannot create column "C" based on your measure's value. 

Calculated columns are only calculated when you first define them and during a dataset refresh, it will not change by filters, it is a definite value, if you expect the value changes with filter, you can only use a measure.

 

In a measure, columns cannot be referenced directly, MAX function in a measure can return the current value in the same row of the column.

 

You can learn more about measures and calculated column in this article: calculated-measures-vs-calculated-columns

 

And according your provided,you could create a measure like the below:

country1 = IF(SELECTEDVALUE(SwitchLanguage[Language])="English",MAX(F_Workers[Country]),LOOKUPVALUE(D_Country[Czech],D_Country[English],MAX(F_Workers[Country])))

vluwangmsft_0-1650265833463.pngvluwangmsft_1-1650265857596.png

 

Did I answer your question? Mark my post as a solution!


Best Regards

Lucien

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.