Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Unable to Use RELATED in a measure

This is a peculiar issue I’m facing –

Lets say I’ve a following Table A

UniqueID User
A1 Adam
A2 Dim
A3 Jo
A4 Bill

and Table B

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

UniqueID RelatedID Type
B1 A2 Email
B2 Email
B3 A3 Note
B4 C5 App

They have an Active Relationship- (Table A[UniqueID] 1:N Table B[RelatedID]).

My Slicer is Based of – TableA[User] and I wanted a count of only those IDs to show up which had a user in Table A

I Made the Following Measure –


EmailCount = 
Var _eCount = 
CALCULATETABLE(TableB, TableB[Type] =  "Email" && TableB[RelatedID] <> BLANK() && NOT(ISBLANK(RELATED(TableA[User]))))

Return COUNTROWS(_eCount)

I’m getting the following error –

The column 'TableA[User]' either doesn't exist or doesn't have a relationship to any table available in the current context

Not sure what I’m doing wrong here.

>Solution :

EmailCount = 
Var _eCount = 
CALCULATETABLE(TableB, 
FILTER(TableB, 

TableB[Type] =  "Email" && TableB[RelatedID] <> BLANK() && NOT(ISBLANK(RELATED(TableA[User])))))

Return COUNTROWS(_eCount)

Explanation:

Your original expands as follows. i.e. ALL() can only cover columns from the same table and there is no Table A to reference. The FILTER in my solution above permits access to the expanded table (in this case both tables)

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading