Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I am having issues with a calculation based on data originating from USERPRINCIPLENAME. I created two measures, one to capture the user's info and the other to query a table that tells the type of the user.
Measure 1:
RLS User = USERPRINCIPALNAME()
Measure 2:
RLS RoleType =
// Get the role type for the RLS user from the ORG query
VAR _RLSUser = [RLS User]
RETURN
LOOKUPVALUE(
ORG[ROLETYPE],
ORG[SOFTWARE_UPDT_USR],
_RLSUser
)
Both measures were successful in their tasks, so I know the user's name and their role type, "Type1" and "Type2".
I then want to perform math in another meaure depending on the type returned. If Type1 then I want to divide a number by 1, but if Type2 then I want to divide by 2. Something like
Goal =
VAR _Denominator = IF([RLS RoleType] = "Type1",1,2)
RETURN
Calculate (SUM(Revenue)/_Denominator,
'Product'[Product Name] = "Red"
)
But when I try this, I recieve the message that, "CUSTOMDATA, USERNAME, USERCULTURE and USERPRINCIPLENAME functions are not supported in calculated tables/columns. These functions may only be used in Measures or in AllowedRowsExpression." This is unexpected, since all my calculations are done within measures.
I have tried moving the determination of the denominator into it's own seperate measure thinking that perhaps having the calculation in a seperate measure from the IF logic would make a difference, but it did not. I tried taking the value of the denominator and changing it to a string and then back to a number, but that resulted in the same error.
Any thoughts on how one might perform such a calulation without error?
Thanks!
@jflipse , seem like you are creating goal as column not meausre
Thanks @amitchandak , in my model I've confirmed I am creating Goal as a measure.
User | Count |
---|---|
55 | |
22 | |
18 | |
16 | |
11 |
User | Count |
---|---|
84 | |
54 | |
39 | |
21 | |
16 |