Forum Discussion
Anonymous
5 years agoNot applicable
How to search a column values from another table column using IN Operator
I have 6 columns as below:
Table Name: Fixed_Deposit
| Customer ID | Account No | Account Type | Base Value | Current Value | Flag |
| 12345 | 100011010 | Fixed Deposit | 1000 | 1111 | 1 |
| 12345 | 100001000 | Saving Account | 100 | 111 | 0 |
| 12345 | 100100100 | Saving Account | 100000 | 10000 | 0 |
| 21223 | 123312233 | Fixed Deposit | 1000 | 1112223 | 0 |
| 21223 | 123323212 | Saving Account | 10101 | 1223123 | 0 |
| 31221 | 231233212 | Fixed Deposit | 12212 | 123321 | 1 |
| 31221 | 123321332 | Current Account | 2312 | 12331 | 0 |
| 32222 | 433434312 | Fixed Deposit | 2221 | 1122212 | 0 |
| 12345 | 233323232 | Current Account | 2222 | 1221222 | 0 |
Now, I have a flag set to 1 for all the Fixed Deposit accounts. I need the sum of their Base Amount and Current Amount as 2 seperate columns in the matrix.
How do I get this?
I have used the below dax query:
I have created a new table using below Dax:
Unique_Customer = CALCULATETABLE(DISTINCT(Fixed_Deposit[Customer ID]),Fixed_Deposit[Flag]=1)
Then I created a measure on my base table using below query:
FD CA Base = var a = DISTINCT(Unique_customer[Customer ID])
return
CALCULATE(SUM(Fixed_Deposit[Base Value])/10000000,FILTER(Fixed_Deposit,Fixed_Deposit[Customer ID] in a),FILTER(Fixed_Deposit,Fixed_Deposit[Account Type]="Current Account"))
Respectively for Savings Account and Fixed Deposit Accounts.
Required Output:
| Customer ID | Base CA Amount | Base SA Amount | Base FD Amount |
| 12345 | 2222 | 100100 | 1000 |
| 31221 | 2312 | 0 | 12212 |
2 Replies
- Greg_Deckler
Community Champion
Anonymous - Where is the Base CA column coming from?
- AnonymousNot applicable
Greg_Deckler - Base CA means Base Value for Account Type = "Current Account"
Similarly for Base SA and Base FD.