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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
MiKeZZa
Post Patron
Post Patron

Manipulating column on USERPRINCIPALNAME()

Hi all,

 

I want to make something like this:

 

TABLE:

Field 1

Field 2

Field 3

 

This table must have a Field 4 which contains Field 1 if the logged in person is in Active Directory Group 'Group A', if he is 'Group B' it must contain Field 2 and otherwise it must contain Field 3.

 

I have a table in my model which contains this:


UPN                                         IsMemberOfGroupA     IsMemberOfGroupB

mailaddress                             1                                    0
.....................

 

I've tried so many things, but I'm not able to fix this. I get problems with using USERPRINCIPALNAME() in row-context, not unique values and so on.... I'm totally clueless.

 

Can somebody tell me with which DAX expression in TABLE I can do this?

6 REPLIES 6
vanessafvg
Super User
Super User

have you tried the switch statement?

 

something to the effect off

 

switch(true(),

          and (ismembergroupA = 1, ismembergroupb = 0), "Result",

      and (ismembergroupA = 0, ismembergroupb = 1), "Result",

      "Other Result")

 

 

 





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




That gives an error that I've already got and what makes clear that I'm not familiar enough with DAX... It gives:

 

A single value for column 'IsGroupA' in table 'member groups' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.

can i see your dax code with an example of the data





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




We've mailed and Vanessas solution is to combine everything in 1 table. A solution that absolute will work, but not what I'm looking for...

 

I'm afraid I'm looking for something that is not possible....

out of curiosity why does combining the tables not work for you?





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




I think it will work, but it's not what I was hoping for. This gives me 2 'facttables', only for something easy (in other languages/tools) as this:

 

if (username IN (list of people that are manager)
{
           FieldA
}
else
{
           FieldB
}

So I'm still hoping to solve it another way, that is also easier to understand for other people at a later moment....

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors