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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

Slicer selection value in calculated column.

Hi,

I have a scenario wherein, I have a UserName table that contains distinct user names -

UserName
Annie
Scott
Henry

 

Now, There is a fact table UserDetails which has following columns.

UserNamePortfolioCountry
AnnieDSDenmark
AnnieDSNorway
AnnieTECHDenmark
AnnieDigitalNorway
ScottDigitalCanada
ScottConsultingUS
HenryConsultingAUSTRIA
HenryTECHITALY
HenryDSGREECE

 

I need to create a matrix with Portfolio as rows and Country as column. 

when a UserName(from UserName table) is selected in a slicer it should not filter the rows but only the columns.

I want to create a dynamic column that will give me the country names for the user selected from the UserName table. 

Also, UserName and UserDetails tables are not related and I'm using reading UserName using selectedValue function and passing that measure in a column(CountryList) to fetch country names from UserDetails table.

 

Measure in UserName table - 

SelectedUserName = 

var selection = SELECTEDVALUE(UserName[UserName])
return selection
 

column in UserDetails -

CountryList = If(UserDetails[UserName]=[SelectedUserName],UserDetails[Country],Blank())

 

But this doesn't seem to be working. Can anyone please help?

 

4 REPLIES 4
v-qiuyu-msft
Community Support
Community Support

Hi @Anonymous, 

 

It's not supported to create a calculated column based on the slicer selection. You can create a measure, and turn on Show items with no data for matrix Rows bucket.  

 

Measure = IF(MAX('UserDetails'[UserName])=SELECTEDVALUE('UserName'[UserName]),1,BLANK())
 
q3.PNG

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi, v-qiuyu-msft 

Also, I have 2 row levels in a matrix. 1st level - market segment and 2nd level - portfolio. 

with one column - Country.

This logic works fine if I use Name column as well as 1st level in the matrix. Not sure why it is not working otherwise.

my requirement is not to see Name in the matrix. 

 

Can u help with this?

Hi @Anonymous, 

 

Please share pbix file with some dummy data, and clarify corresponding result. 

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi v-qiuyu-msft,

 

I have a large dataset but this measure is not returning 1 for few rows even when the names are matching from UserName and UserDetails.

Any idea why is this happening?

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.