cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

Mdxscript (Model) Calculation error

Hi there,

I am getting an error

suvechha_0-1597394307532.png

 


for the Measures :

SDUserId = CALCULATE(
VALUES(SDUser[USERID]),
USERELATIONSHIP(WorkOrderStates[OWNERID], SDUser[USERID])
)



I have a sql query like below :

SELECT top 10 "wo"."WORKORDERID" AS "Request ID",
"aau"."FIRST_NAME" AS "Requester",
"ti"."FIRST_NAME" AS "Technician",
"wo"."CREATEDTIME" AS "Created Time"
FROM "WorkOrder" "wo" LEFT JOIN "SDUser" "sdu"
ON "wo"."REQUESTERID"="sdu"."USERID"
LEFT JOIN "AaaUser" "aau" ON "sdu"."USERID"="aau"."USER_ID"
LEFT JOIN "WorkOrderStates" "wos" ON "wo"."WORKORDERID"="wos"."WORKORDERID"
LEFT JOIN "SDUser" "td" ON "wos"."OWNERID"="td"."USERID"
LEFT JOIN "AaaUser" "ti" ON "td"."USERID"="ti"."USER_ID"

To get the Technicial value , I have to create userrelationship() but its not working.
Please kindly assist.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User IX
Super User IX

Re: Mdxscript (Model) Calculation error

@suvechha , you need have some operation like , min , max , count , sum

 

SDUserId = CALCULATE(
Count(SDUser[USERID]),
USERELATIONSHIP(WorkOrderStates[OWNERID], SDUser[USERID])
)

 

to get top 10, use topn or rank

For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/3...



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

2 REPLIES 2
Highlighted
Super User IX
Super User IX

Re: Mdxscript (Model) Calculation error

@suvechha , you need have some operation like , min , max , count , sum

 

SDUserId = CALCULATE(
Count(SDUser[USERID]),
USERELATIONSHIP(WorkOrderStates[OWNERID], SDUser[USERID])
)

 

to get top 10, use topn or rank

For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/3...



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

Highlighted
Community Support
Community Support

Re: Mdxscript (Model) Calculation error

Hi , @suvechha 

Take a try to use FIRSTNONBLANK(SDUser[USERID], 1) instead of SDUser[USERID].

 

Best Regards,
Community Support Team _ Eason

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Upcoming Events

Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors