Forum Discussion

MiKeZZa's avatar
MiKeZZa
Post Patron
9 years ago

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

  • vanessafvg's avatar
    vanessafvg
    Community Champion

    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")

     

     

     

    • MiKeZZa's avatar
      MiKeZZa
      Post Patron

      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.

      • vanessafvg's avatar
        vanessafvg
        Community Champion

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