Forum Discussion

Mamoun_issa's avatar
Mamoun_issa
Frequent Visitor
6 years ago

Tables with Two Key

Hello,

 

I Have two tables the first includes the Revenue Details and the other one claims, the tables looks something similar to the below,

 

Medical Record NoVisit NumberVisit DateNameClaim IDPhamracy Claim IDInvoice Amount
XXVAN1001 Jan 20JohnCL1000 150
YYVAN2001 Jan 20Adam CLP2000250
ZZVAN3005 Jan 20LawranceCL1500CLP2500500

 

And the other table Include the the Claims Details as follow:

Claim IDPayment Date Payment Amount
CL10002 Feb 20150
CLP20005 Feb 20200
CL15003 March 20200
CLP25007 Feb 20300

 

Im trying to create a relation between the two tables but since there is two coulmns in the first table as the primary key and only one in the second table i could not get, im looking to build a summary that looks like 

Visit Number ( Table 1 )Claimed Amount (Table 1)Paid Amount (Table 2 )
VAN100150150
VAN200250200
VAN300500500

7 Replies

  • az38's avatar
    az38
    Community Champion

    Hi Mamoun_issa 

    you can add a measure to your Revenue Details table

    Paid Amount = 
    CALCULATE(SUM('Claims Details'[Payment Amount]); 
    FILTER(ALL('Claims Details');
    'Claims Details'[Claim ID]=SELECTEDVALUE('Revenue Details'[Claim ID]) || 'Claims Details'[Claim ID]=SELECTEDVALUE('Revenue Details'[Phamracy Claim ID])
    )
    )

     

    do not hesitate to give a kudo to useful posts and mark solutions as solution

    • Mamoun_issa's avatar
      Mamoun_issa
      Frequent Visitor

      az38 Thank you for your response , but unfortunatly this did not work out since in the revenue details the claim ID and Pharmacy Claim ID are in the same row, so it took only the first expression (i.e. Claim ID)

      • az38's avatar
        az38
        Community Champion

        Hi Mamoun_issa 

        i don't understand. it works perfect on your data sample

        please, extend your mention, what do you mean "first expression"?

         

        do not hesitate to give a kudo to useful posts and mark solutions as solution