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
m4xon
Helper III
Helper III

Slicer categories based on the USERNAME from separate table

Hello,

I have a table with lot of data divided into categories like (Internal, External, All) and I have a slicer to filter it easily based on these categories. I was asked to add following feature:

If USERNAME will exist in the table of users having access to the external category (dimUsersExternal) then on the Slicer show External category, otherwise others except this one.

Is it possible to achive it using DAX measure?

 

Thank you in advance,

Max

1 ACCEPTED SOLUTION

Hi @m4xon 

You can refer to the following measure

Measure = var a=COUNTROWS(FILTER('User',[Column1]=[Username]))
return 
IF(a>0,1,IF(not  "external" in VALUES('Table 2'[Value]) ,1, 0))

Best Regards!

Yolo Zhu

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

5 REPLIES 5
m4xon
Helper III
Helper III

@v-xinruzhu-msft works like a charm! Thank you!

m4xon
Helper III
Helper III

Anyone could help me with that? Thank you in advance

Hi @m4xon 

You can refer to the following example

Sample data 

vxinruzhumsft_2-1690772591470.png

 

Slicer table

vxinruzhumsft_3-1690772601394.png

Sample username measure

Username = "test1@abc.com"

Then  create a measure

Measure = var a=COUNTROWS(FILTER('User',[Column1]=[Username]))
return 
IF(a>0,IF("external" in VALUES('Table 2'[Value]),1),IF(not  "external" in VALUES('Table 2'[Value]) ,1, 0))

Then put the measure to slicer visual filter

vxinruzhumsft_4-1690772747244.png

Output

vxinruzhumsft_5-1690772815398.png

Best Regards!

Yolo Zhu

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

 

 

 

 

@v-xinruzhu-msft one remark, how to modify measure to see all of the options when you are on the list. So in your example, when test1@abc.com is on the list then except All and Internal visible is also External, not only external. Thanks!

Hi @m4xon 

You can refer to the following measure

Measure = var a=COUNTROWS(FILTER('User',[Column1]=[Username]))
return 
IF(a>0,1,IF(not  "external" in VALUES('Table 2'[Value]) ,1, 0))

Best Regards!

Yolo Zhu

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

 

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.