Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric 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.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Ask questions in Eventhouse and KQL, Eventstream, and Reflex.
User | Count |
---|---|
69 | |
35 | |
21 | |
18 | |
15 |
User | Count |
---|---|
127 | |
32 | |
27 | |
24 | |
22 |